X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D9E1AD1B192 for ; Thu, 5 Aug 2004 17:23:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86494-04 for ; Thu, 5 Aug 2004 20:22:41 +0000 (GMT) Received: from web53309.mail.yahoo.com (web53309.mail.yahoo.com [206.190.39.238]) by svr1.postgresql.org (Postfix) with SMTP id 587F3D1B343 for ; Thu, 5 Aug 2004 17:22:32 -0300 (ADT) Message-ID: <20040805202229.81960.qmail@web53309.mail.yahoo.com> Received: from [204.27.176.24] by web53309.mail.yahoo.com via HTTP; Thu, 05 Aug 2004 13:22:29 PDT Date: Thu, 5 Aug 2004 13:22:29 -0700 (PDT) From: Mark Richardson Subject: Re: DataType OID for PQexecParams-call in libpq To: pgsql-interfaces@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1815835316-1091737349=:81841" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_FONTCOLOR_BLUE, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200408/5 X-Sequence-Number: 5053 --0-1815835316-1091737349=:81841 Content-Type: text/plain; charset=us-ascii Tom Lane writes: >>Gergely Czuczy 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.. enum OID_TYPES { BOOLOID=16, BYTEAOID=17, CHAROID=18, ... } 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! --0-1815835316-1091737349=:81841 Content-Type: text/html; charset=us-ascii

Tom Lane writes:

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

>> please take a look at the documentation at

>> <http://www.postgresql.org/docs/7.4/static/libpq-exec.html>

>> 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..

enum OID_TYPES

{

BOOLOID=16,

BYTEAOID=17,

CHAROID=18,

...

}

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! --0-1815835316-1091737349=:81841--