pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-interfaces@postgreSQL.org
Subject: Field types (was Re: Return value of int)
Date: Sun, 02 May 1999 18:36:41 -0400
Message-ID: <16187.925684601@sss.pgh.pa.us> (raw)
In-Reply-To: <m10e211-0000bIC@druid.net>

"D'Arcy" "J.M." Cain <darcy@druid.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



view thread (6+ messages)  latest in thread

Message-ID: <16187.925684601@sss.pgh.pa.us>
Permalink:  ../16187.925684601@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16187.925684601@sss.pgh.pa.us

 · 

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: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: Field types (was Re: Return value of int)
  In-Reply-To: <16187.925684601@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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