Re: DataType OID for PQexecParams-call in libpq - Mailing list pgsql-interfaces
From | Richardson Mark |
---|---|
Subject | Re: DataType OID for PQexecParams-call in libpq |
Date | |
Msg-id | 79B88CFF7CD141438CF5C022134B5EB3C80A8E@imager8.corp.spaceimaging.com Whole thread Raw |
In response to | DataType OID for PQexecParams-call in libpq ("Jan Klostermann" <klostermann@rhf.de>) |
List | pgsql-interfaces |
<p><font face="Arial" size="2">Tom Lane writes:</font><br /><font face="Arial" size="2">>></font><font face="TimesNew Roman">Gergely Czuczy <phoemix ( at ) harmless ( dot ) hu> writes:</font><br /><font face="Times NewRoman">>> please take a look at the documentation at </font><br /><font face="Times New Roman">>><u> </u></font><u><fontcolor="#0000FF" face="Times New Roman"><<a href="http://www.postgresql.org/docs/7.4/static/libpq-exec.html">http://www.postgresql.org/docs/7.4/static/libpq-exec.html</a>></font></u><font face="TimesNew Roman"> </font><br /><font face="Times New Roman">>> at the point "PQftype", where it's said: </font><br/><font face="Times New Roman">>> " The OIDs of the built-in data types are defined in the file </font><br/><font face="Times New Roman">>> src/include/catalog/pg_type.h in the source tree." </font><p><font face="TimesNew Roman">>Also, you can get the OID on the fly, eg with</font><br /><font face="Times New Roman">> SELECToid FROM pg_type WHERE typname = ...</font><br /><font face="Times New Roman">> For standard built-in types it's>okay to hard-wire OID values into your </font><br /><font face="Times New Roman">> code, but if you want to beable to deal with user-defined types you</font><br /><font face="Times New Roman">> shouldn't rely on the OID beingconstant.</font><br /><font face="Times New Roman">> regards, tom lane </font><p><font face="Arial" size="2">Thepg_type.h file has all sorts of other stuff in it - so including it while coding a client I makes a mess - Iwould 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 knowthe oid of the value coming back from that select statement (never ending loop!). I would love to see something likepg_oid_type.h that is something like this..</font><p><font face="Arial" size="2">enum OID_TYPES</font><br /><font face="Arial"size="2">{</font><br /><font face="Arial" size="2"> BOOLOID=16,</font><br /><font face="Arial" size="2"> BYTEAOID=17,</font><br/><font face="Arial" size="2"> CHAROID=18,</font><br /><font face="Arial" size="2">...</font><br /><fontface="Arial" size="2">}</font><br /><font face="Arial" size="2">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, andnot everything else for a client).</font><p><font face="Arial" size="2">My 2 cents</font><br /><font face="Arial" size="2">Mark</font><fontsize="3"><br /><br /> ********************************************************************************<br/> This message is intended only for theuse of the Addressee and may<br /> contain information that is PRIVILEGED and CONFIDENTIAL.<br /><br /> If you are notthe intended recipient, you are hereby notified that any<br /> dissemination of this communication is strictly prohibited.If you have<br /> received this communication in error, please erase all copies of the<br /> message and its attachmentsand notify Space Imaging immediately.<br /> ********************************************************************************<br/></font>
pgsql-interfaces by date: