Open
Description
- What versions are you using?
Oracle 19
platform.platform: Linux-4.18.0-372.76.1.el8_6.x86_64-x86_64-with-glibc2.28
sys.maxsize > 2**32: True
platform.python_version: 3.13.0
oracledb.version: 2.4.1
- Is it an error or a hang or a crash?
Error
- What error(s) or behavior you are seeing?
When inserting a naive or a timezone aware datetime into an oracle TIMESTAMP WITH TIMEZONE column, the result is always saved in GMT.
I'm under the impression that it didn't used to do this.
This bug is happening in both thick and thin mode.
- Does your application call init_oracle_client()?
The same bug occurs in thinmode and thickmode.
- Include a runnable Python script that shows the problem.
CREATE TABLE foo (bar TIMESTAMP WITH TIME ZONE);
import oracledb
oracledb.init_oracle_client()
from datetime import datetime
from zoneinfo import ZoneInfo
conn = oracledb.connect('user/pass@database')
cur = conn.cursor()
naive = datetime(2024, 10, 25, 1, 2, 3)
aware = naive.replace(tzinfo=ZoneInfo('America/Los_Angeles'))
cur.execute('INSERT INTO foo VALUES (:d)', dict(d=naive))
cur.execute('INSERT INTO foo VALUES (:d)', dict(d=aware))
conn.commit()
SELECT * FROM foo
This outputs:
2024-10-25 01:02:03.000000000 GMT
2024-10-25 01:02:03.000000000 GMT