fix: use timedelta instead of time to cast TIME column in B compatibility mode(#IAIE7I)

In mysql compatibility mode, we should convert the TIME column to a python datetime.timedelta type,
just like the behavior of PyMySQL and mysql-connector-python.

See also:
- PyMySQL: 95635f587b/pymysql/converters.py (L344)
- mysql-connector-python: 59817f3de4/mysql-connector-python/lib/mysql/connector/conversion.py (L593)
This commit is contained in:
vimiix
2024-08-21 12:23:47 +08:00
parent 544701b4d8
commit 6eb67283df
5 changed files with 47 additions and 7 deletions

View File

@ -88,5 +88,7 @@ HIDDEN PyObject *typecast_array_from_python(
HIDDEN PyObject *typecast_cast(
PyObject *self, const char *str, Py_ssize_t len, PyObject *curs);
HIDDEN long convert_time_oid_to_interval_oid(long value);
#endif /* !defined(PSYCOPG_TYPECAST_H) */
PyObject *typecast_new(PyObject *name, PyObject *values, PyObject *cast, PyObject *base);