{"action":"created","issue":{"url":"https://api.github.com/repos/psycopg/psycopg2/issues/278","labels_url":"https://api.github.com/repos/psycopg/psycopg2/issues/278/labels{/name}","comments_url":"https://api.github.com/repos/psycopg/psycopg2/issues/278/comments","events_url":"https://api.github.com/repos/psycopg/psycopg2/issues/278/events","html_url":"https://github.com/psycopg/psycopg2/issues/278","id":54177037,"number":278,"title":"Error while converting time 24:00:00","user":{"login":"fogzot","id":122377,"avatar_url":"https://avatars.githubusercontent.com/u/122377?v=3","gravatar_id":"","url":"https://api.github.com/users/fogzot","html_url":"https://github.com/fogzot","followers_url":"https://api.github.com/users/fogzot/followers","following_url":"https://api.github.com/users/fogzot/following{/other_user}","gists_url":"https://api.github.com/users/fogzot/gists{/gist_id}","starred_url":"https://api.github.com/users/fogzot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fogzot/subscriptions","organizations_url":"https://api.github.com/users/fogzot/orgs","repos_url":"https://api.github.com/users/fogzot/repos","events_url":"https://api.github.com/users/fogzot/events{/privacy}","received_events_url":"https://api.github.com/users/fogzot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/psycopg/psycopg2/milestones/8","labels_url":"https://api.github.com/repos/psycopg/psycopg2/milestones/8/labels","id":780347,"number":8,"title":"psycopg 2.5.5","description":null,"creator":{"login":"dvarrazzo","id":199429,"avatar_url":"https://avatars.githubusercontent.com/u/199429?v=3","gravatar_id":"","url":"https://api.github.com/users/dvarrazzo","html_url":"https://github.com/dvarrazzo","followers_url":"https://api.github.com/users/dvarrazzo/followers","following_url":"https://api.github.com/users/dvarrazzo/following{/other_user}","gists_url":"https://api.github.com/users/dvarrazzo/gists{/gist_id}","starred_url":"https://api.github.com/users/dvarrazzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvarrazzo/subscriptions","organizations_url":"https://api.github.com/users/dvarrazzo/orgs","repos_url":"https://api.github.com/users/dvarrazzo/repos","events_url":"https://api.github.com/users/dvarrazzo/events{/privacy}","received_events_url":"https://api.github.com/users/dvarrazzo/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":1,"state":"open","created_at":"2014-09-05T21:18:07Z","updated_at":"2015-01-13T12:37:18Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-01-13T10:45:28Z","updated_at":"2015-01-14T08:11:22Z","closed_at":null,"body":"PostgreSQL can store `time` (with or without TZ) values from 0:00:00 to 24:00:00 while Python `datetime.time` only accepts values up to 23:59:59 (stupid the package that can't represent leap seconds is!)\r\n\r\n    >>> import psycopg2\r\n    >>> conn = psycopg2.connect(\"dbname=test\")\r\n    >>> curs = conn.cursor()\r\n    >>> curs.execute(\"SELECT '24:00:00'::time\")\r\n    >>> curs.fetchall()\r\n    Traceback (most recent call last):\r\n      File \"<stdin>\", line 1, in <module>\r\n    ValueError: hour must be in 0..23\r\n\r\nNote that this is only about `time` values: PostgreSQL seems to always convert a `timestamp` ending in 24:00:00 into the midnight of the day after, i.e., 2012-6-30T24:00:00 -> 2012-7-1T00:00:00.\r\n\r\nReference to StackOverflow question: http://stackoverflow.com/questions/27919727/postgresql-time-conversion-formatting-from-240000-to-000000-in-select-st/27920175"},"comment":{"url":"https://api.github.com/repos/psycopg/psycopg2/issues/comments/69882381","html_url":"https://github.com/psycopg/psycopg2/issues/278#issuecomment-69882381","issue_url":"https://api.github.com/repos/psycopg/psycopg2/issues/278","id":69882381,"user":{"login":"fogzot","id":122377,"avatar_url":"https://avatars.githubusercontent.com/u/122377?v=3","gravatar_id":"","url":"https://api.github.com/users/fogzot","html_url":"https://github.com/fogzot","followers_url":"https://api.github.com/users/fogzot/followers","following_url":"https://api.github.com/users/fogzot/following{/other_user}","gists_url":"https://api.github.com/users/fogzot/gists{/gist_id}","starred_url":"https://api.github.com/users/fogzot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fogzot/subscriptions","organizations_url":"https://api.github.com/users/fogzot/orgs","repos_url":"https://api.github.com/users/fogzot/repos","events_url":"https://api.github.com/users/fogzot/events{/privacy}","received_events_url":"https://api.github.com/users/fogzot/received_events","type":"User","site_admin":false},"created_at":"2015-01-14T08:11:22Z","updated_at":"2015-01-14T08:11:22Z","body":"Yep, given that the problem happens only for `time` we can simply convert implicitly 24:00 to 00:00: you are going back in time but nobody notices it because there isn't a date as reference (and PostgreSQL does this for `timestamp` anyway)."}}