mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Merge branch 'fix-707'
This commit is contained in:
commit
aac8a20fc1
|
@ -406,6 +406,11 @@ typecast_PYINTERVAL_cast(const char *str, Py_ssize_t len, PyObject *curs)
|
|||
}
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
PyErr_SetString(NotSupportedError,
|
||||
"iso_8601 intervalstyle currently not supported");
|
||||
return NULL;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -438,6 +438,14 @@ class DatetimeTests(ConnectingTestCase, CommonDatetimeTestsMixin):
|
|||
r = cur.fetchone()[0]
|
||||
self.assertEqual(r, v, "%s -> %s != %s" % (s, r, v))
|
||||
|
||||
@skip_before_postgres(8, 4)
|
||||
def test_interval_iso_8601_not_supported(self):
|
||||
# We may end up supporting, but no pressure for it
|
||||
cur = self.conn.cursor()
|
||||
cur.execute("set local intervalstyle to iso_8601")
|
||||
cur.execute("select '1 day 2 hours'::interval")
|
||||
self.assertRaises(psycopg2.NotSupportedError, cur.fetchone)
|
||||
|
||||
|
||||
# Only run the datetime tests if psycopg was compiled with support.
|
||||
if not hasattr(psycopg2.extensions, 'PYDATETIME'):
|
||||
|
|
Loading…
Reference in New Issue
Block a user