postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[postgresql-interfaces/psqlodbc] issue #95: SELECT does not return TimeZone Info from a TIMESTAMP with TIME ZONE column
7+ messages / 2 participants
[nested] [flat]

* [postgresql-interfaces/psqlodbc] issue #95: SELECT does not return TimeZone Info from a TIMESTAMP with TIME ZONE column
@ 2025-03-07 03:13  "raddakal (@raddakal)" <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: raddakal (@raddakal) @ 2025-03-07 03:13 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

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.

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [postgresql-interfaces/psqlodbc] issue #95: SELECT does not return TimeZone Info from a TIMESTAMP with TIME ZONE column
@ 2025-03-07 10:56  "davecramer (@davecramer)" <[email protected]>
  5 siblings, 0 replies; 7+ messages in thread

From: davecramer (@davecramer) @ 2025-03-07 10:56 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

That's interesting. Thanks for the report

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [postgresql-interfaces/psqlodbc] issue #95: SELECT does not return TimeZone Info from a TIMESTAMP with TIME ZONE column
@ 2025-03-10 13:07  "davecramer (@davecramer)" <[email protected]>
  5 siblings, 0 replies; 7+ messages in thread

From: davecramer (@davecramer) @ 2025-03-10 13:07 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

From what I can tell ODBC does not support TIMESTAMP WITH TIME ZONE. I'm as surprised as you are.
I would not expect it to simply truncate it. Does it return it with the time adjusted correctly?

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [postgresql-interfaces/psqlodbc] issue #95: SELECT does not return TimeZone Info from a TIMESTAMP with TIME ZONE column
@ 2025-03-11 16:06  "raddakal (@raddakal)" <[email protected]>
  5 siblings, 0 replies; 7+ messages in thread

From: raddakal (@raddakal) @ 2025-03-11 16:06 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

It simply truncates the time zone component without adjusting the data value.  
Can the timetz/timestamptz data be returned as any other SQL_VARCHAR data column (to return the data as is)?



Thanks.

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [postgresql-interfaces/psqlodbc] issue #95: SELECT does not return TimeZone Info from a TIMESTAMP with TIME ZONE column
@ 2025-03-14 10:57  "davecramer (@davecramer)" <[email protected]>
  5 siblings, 0 replies; 7+ messages in thread

From: davecramer (@davecramer) @ 2025-03-14 10:57 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

I suppose it could. Feel free to provide a PR

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [postgresql-interfaces/psqlodbc] issue #95: SELECT does not return TimeZone Info from a TIMESTAMP with TIME ZONE column
@ 2025-09-19 06:47  "raddakal (@raddakal)" <[email protected]>
  5 siblings, 0 replies; 7+ messages in thread

From: raddakal (@raddakal) @ 2025-09-19 06:47 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

Can you please let us know what is the process for submitting the PR? Do I need to obtain any privileges to be able to submit the PR? If there is any document for this process, please share the same.

We will try to work on this issue.


Thanks.



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [postgresql-interfaces/psqlodbc] issue #95: SELECT does not return TimeZone Info from a TIMESTAMP with TIME ZONE column
@ 2025-09-19 15:44  "davecramer (@davecramer)" <[email protected]>
  5 siblings, 0 replies; 7+ messages in thread

From: davecramer (@davecramer) @ 2025-09-19 15:44 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

clone the repo into your own account. create a branch, make your changes and push to that branch. Then create a PR from your branch

^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2025-09-19 15:44 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-07 03:13 [postgresql-interfaces/psqlodbc] issue #95: SELECT does not return TimeZone Info from a TIMESTAMP with TIME ZONE column "raddakal (@raddakal)" <[email protected]>
2025-03-07 10:56 ` "davecramer (@davecramer)" <[email protected]>
2025-03-10 13:07 ` "davecramer (@davecramer)" <[email protected]>
2025-03-11 16:06 ` "raddakal (@raddakal)" <[email protected]>
2025-03-14 10:57 ` "davecramer (@davecramer)" <[email protected]>
2025-09-19 06:47 ` "raddakal (@raddakal)" <[email protected]>
2025-09-19 15:44 ` "davecramer (@davecramer)" <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox