postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: raddakal (@raddakal) <[email protected]>
To: postgresql-interfaces/psqlodbc <[email protected]>
Subject: [postgresql-interfaces/psqlodbc] issue #95: SELECT does not return TimeZone Info from a TIMESTAMP with TIME ZONE column
Date: Fri, 07 Mar 2025 03:13:33 +0000
Message-ID: <[email protected]> (raw)
We are using the PostgreSQL native ODBC driver to select data from a PostgreSQL table with timestamp with time zone column. The driver is truncating the TIMEZONE component from the data and is just returning the timestamp value.
The DDL and DML details are given below:
postgres=# create table public.tstztab(tscol timestamp, tstzcol timestamptz);
CREATE TABLE
postgres=# insert into public.tstztab values(current_timestamp, current_timestamp);
INSERT 0 1
postgres=# select * from public.tstztab;
tscol | tstzcol
----------------------------+-------------------------------
2025-03-06 18:10:10.732499 | 2025-03-06 18:10:10.732499-08
(1 row)
And when we run the program to select the data from both the columns, We get the same data for both the columns, where the tz info is getting truncated (basically getting the wrong data). Please note that the SQL_C_CHAR is used as the C data type for both the columns.
bash-4.4$ ./a.out
Connecting to database.
Connected to database.
Fetching results...
2025-03-06 18:10:10.732499 2025-03-06 18:10:10.732499
Attached the standalone ODBC program, using which the reported issue can be easily reproduced.
[select_ts_pg.txt](https://github.com/user-attachments/files/19119502/select_ts_pg.txt)
Can you please let us know how to retrieve the complete data (including the TZ component) from a TIMESTAMP with TIME ZONE type column using the PostgreSQL native ODBC driver.
Quick help is much appreciated!!
Thanks,
Ranjeeth.
view thread (7+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://postgresql-interfaces/psqlodbc
Cc: [email protected], [email protected]
Subject: Re: [postgresql-interfaces/psqlodbc] issue #95: SELECT does not return TimeZone Info from a TIMESTAMP with TIME ZONE column
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox