Skip to content

Instantly share code, notes, and snippets.

@gurjeet
Last active August 29, 2015 14:03
Show Gist options
  • Save gurjeet/3f6f8db52454ef557505 to your computer and use it in GitHub Desktop.
Save gurjeet/3f6f8db52454ef557505 to your computer and use it in GitHub Desktop.
Postgres Weird interval representation
postgres=# select '6 days 23:45:00'::interval - '6 days 23:23:00'::interval;
?column?
----------
00:22:00
(1 row)
postgres=# select '00:46:00'::interval - '00:24:00'::interval;
?column?
----------
00:22:00
(1 row)
postgres=# select '6 days 00:16:00'::interval - '5 days 23:54:00'::interval;
?column?
-----------------
1 day -23:38:00
(1 row)
postgres=# select '5 days 23:47:00'::interval - '5 days 23:25:00'::interval;
?column?
----------
00:22:00
(1 row)
postgres=# select '6 days 01:39:00'::interval - '6 days 01:18:00'::interval;
?column?
----------
00:21:00
(1 row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment