Skip site navigation (1) Skip section navigation (2)

Re: DataType OID for PQexecParams-call in libpq

From: Mark Richardson <markmapo(at)yahoo(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: DataType OID for PQexecParams-call in libpq
Date: 2004-08-05 20:22:29
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Tom Lane writes:

>>Gergely Czuczy <phoemix ( at ) harmless ( dot ) hu> writes:

>> please take a look at the documentation at 

>> <> 

>> at the point "PQftype", where it's said: 

>> " The OIDs of the built-in data types are defined in the file 

>> src/include/catalog/pg_type.h in the source tree." 

>Also, you can get the OID on the fly, eg with

> SELECT oid FROM pg_type WHERE typname = ...

> For standard built-in types it's >okay to hard-wire OID values into your 

> code, but if you want to be able to deal with user-defined types you

> shouldn't rely on the OID being constant.

> regards, tom lane 

The pg_type.h file has all sorts of other stuff in it - so including it while coding a client I makes a mess - I would like to have access to the "standard" values (especially since OID's are used in the libpq C interface for select). So, the select statement "select oid from pg_type where typename=.." can't be processed because you need to know the oid of the value coming back from that select statement (never ending loop!). I would love to see something like pg_oid_type.h that is something like this..








so that its easy to get the value of a specific oid, but you can also type cast easily (or have an array of the OID_TYPES). I know this doesn't handle the user defined types, but I think it would be very helpfull (or some defines for the pg_type.h file so that we can get just the oids, and not everything else for a client).

My 2 cents

Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

pgsql-interfaces by date

Next:From: Rich CullingfordDate: 2004-08-09 14:34:33
Subject: Installing "untrusted" python an a PG 7.4.3 DB
Previous:From: Richardson MarkDate: 2004-08-05 20:17:32
Subject: Re: DataType OID for PQexecParams-call in libpq

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group