From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-interfaces(at)postgreSQL(dot)org |
Subject: | Field types (was Re: Return value of int) |
Date: | 1999-05-02 22:36:41 |
Message-ID: | 16187.925684601@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
"D'Arcy" "J.M." Cain <darcy(at)druid(dot)net> writes:
> Regarding this, it would be nice if libpq had some official, documented
> way of determining the type of the field. Currently I deal with this
> in PyGreSQL by stealing some #defines from src/include/catalog/pg_type.h,
> something that isn't normally available to application programmers.
Well, I don't see a big problem with stealing the defines --- the odds
of the OID for INT4, say, ever changing are pretty low.
But of course the "official, documented" way to find out what a given
type OID means is
SELECT typname FROM pg_type WHERE oid = <whatever>;
If you kept a cache of type info on the application side, you could
probably even make this fast enough to be a reasonable approach :-)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Roberto Taglioretti | 1999-05-03 05:00:05 | C program Postgres 6.3 and date |
Previous Message | Roberto Taglioretti | 1999-05-02 21:54:00 | C program Postgres 6.3 and date |