Is there any way to work with duration data?


I have data on the duration of some action. In my PostgreSQL database, the column data type is interval.
Example entries:

  • 00:00:00.157
  • 00:00:00.158
  • 00:00:00.159
  • 00:00:00.169
  • 00:00:00.172
  • 00:00:00.174
  • 00:00:00.175
  • 00:00:00.177
  • 00:00:00.177

I've found an open GitHub issue on full support for the interval data type, with some progress already completed. However, I'd like to ask - is there any workaround that would enable work with this field right now? Can I cast it somehow to an integer? All I need is to create a sum of the duration grouped by day.

Thank you!

Just use a view in the database that casts that to an integer