Re: [INTERFACES] Field types (was Re: Return value of int)

From: Hugh Lawson <hglawson(at)nr(dot)infi(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] Field types (was Re: Return value of int)
Date: 1999-05-03 21:45:21
Message-ID: Pine.LNX.4.04.9905031742110.745-100000@cumquat.fruit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Sun, 2 May 1999, Tom Lane wrote:

> "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>;

I'm just getting started on fiddling with libpq. I am wondering why
this passage from man libpq doesn't address this issue? I'm not being
a smarty here, I just don't know the answer.

PQftype returns the field type associated with the
given field index. The integer returned is an
internal coding of the type. Field indices start
at 0.
Oid PQftype(PGresult *res,
int field_num);

Hugh Lawson
Greensboro, North Carolina
hglawson(at)nr(dot)infi(dot)net

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 1999-05-03 23:54:31 Re: [INTERFACES] Field types (was Re: Return value of int)
Previous Message Martin Sktt 1999-05-03 21:06:04 Problem compiling program