public inbox for [email protected]  
help / color / mirror / Atom feed
After upgrading libpq, the same function(PQftype) call returns a different OID
2+ messages / 2 participants
[nested] [flat]

* After upgrading libpq, the same function(PQftype) call returns a different OID
@ 2025-03-15 18:53 M Tarkeshwar Rao <[email protected]>
  2025-03-15 19:02 ` Re: After upgrading libpq, the same function(PQftype) call returns a different OID Tom Lane <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: M Tarkeshwar Rao @ 2025-03-15 18:53 UTC (permalink / raw)
  To: pgsql-general

Hi all,

We are using PostgreSQL libpq in our application. The code worked fine for the past four years, but after upgrading the library, the function PQftype is returning unexpected values for some columns.
Specifically, the issue occurs with a column of type timestamp(3) without time zone.

What could be causing this change, and how can we resolve it?"

Postgres Version(upgraded from 11.18 to 13.20)

Example:

Before the libpq Upgrade (Expected Behavior)

Let's say your PostgreSQL database has a table:

CREATE TABLE example (
    id SERIAL PRIMARY KEY,
    filetime TIMESTAMP(3) WITHOUT TIME ZONE
);

In the old version of libpq, calling PQftype on the filetime column returns:

Oid filetime_oid = PQftype(res, 1); // Assuming 'filetime' is at index 1
printf("Filetime column OID: %u\n", filetime_oid);

Expected output (before upgrade):
Filetime column OID: 1114

After the libpq Upgrade (Unexpected Behavior)
After upgrading libpq, the same function call returns a different OID, such as 123456.

What could be the reason?

Regards
Tarkeshwar



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

* Re: After upgrading libpq, the same function(PQftype) call returns a different OID
  2025-03-15 18:53 After upgrading libpq, the same function(PQftype) call returns a different OID M Tarkeshwar Rao <[email protected]>
@ 2025-03-15 19:02 ` Tom Lane <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2025-03-15 19:02 UTC (permalink / raw)
  To: M Tarkeshwar Rao <[email protected]>; +Cc: pgsql-general

M Tarkeshwar Rao <[email protected]> writes:
> We are using PostgreSQL libpq in our application. The code worked fine for the past four years, but after upgrading the library, the function PQftype is returning unexpected values for some columns.
> Specifically, the issue occurs with a column of type timestamp(3) without time zone.

The OID of type timestamp has not changed.  Perhaps you are now
querying some other table.  I'd suggest looking into pg_type to
find out what type is represented by the OID you're now getting,
and then searching pg_attribute to see what's using that.

select typname from pg_type where oid = 123456;

select attrelid::regclass, attname from pg_attribute where atttypid = 123456;

Also, if you really do mean that you changed only libpq and
nothing about the server side, I'd have to guess that you're
connecting to some other database than before.  That would be
surprising, but with zero details it's hard to debug.

			regards, tom lane






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


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

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-15 18:53 After upgrading libpq, the same function(PQftype) call returns a different OID M Tarkeshwar Rao <[email protected]>
2025-03-15 19:02 ` Tom Lane <[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