Re: DataType OID for PQexecParams-call in libpq

Lists: pgsql-interfaces
From: "Jan Klostermann" <klostermann(at)rhf(dot)de>
To: <pgsql-interfaces(at)postgresql(dot)org>
Subject: DataType OID for PQexecParams-call in libpq
Date: 2004-03-16 09:28:58
Message-ID: PostgreSQL : libpq에서 pqexecparams-call에 대한
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Hello all!

I would be very thankful, if you could help me out!

To call the PQexecParams() function I need to provide a field with the
data types of the parameters as type OID. OID is a number, but which
numbers correspond to with datatype ?
Where are they documented? Or how can I find out about this data type
codes?

I scanned trough almost the whole documentation but could not find
anything. The examples just skip the problem by using simple strings and
auto-detection.

Any help would be very appreciated! Thanks in advance.

Jan Klostermann


From: Gergely Czuczy <phoemix(at)harmless(dot)hu>
To: Jan Klostermann <klostermann(at)rhf(dot)de>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: DataType OID for PQexecParams-call in libpq
Date: 2004-03-16 13:36:45
Message-ID: Pine.LNX.4.44.0403161435200.22549-100000@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

hello

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

Bye,

Gergely Czuczy
mailto: phoemix(at)harmless(dot)hu
PGP: http://phoemix.harmless.hu/phoemix.pgp

The point is, that geeks are not necessarily the outcasts
society often believes they are. The fact is that society
isn't cool enough to be included in our activities.

On Tue, 16 Mar 2004, Jan Klostermann wrote:

> Hello all!
>
> I would be very thankful, if you could help me out!
>
> To call the PQexecParams() function I need to provide a field with the
> data types of the parameters as type OID. OID is a number, but which
> numbers correspond to with datatype ?
> Where are they documented? Or how can I find out about this data type
> codes?
>
> I scanned trough almost the whole documentation but could not find
> anything. The examples just skip the problem by using simple strings and
> auto-detection.
>
> Any help would be very appreciated! Thanks in advance.
>
> Jan Klostermann
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gergely Czuczy <phoemix(at)harmless(dot)hu>
Cc: Jan Klostermann <klostermann(at)rhf(dot)de>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: DataType OID for PQexecParams-call in libpq
Date: 2004-03-16 15:40:52
Message-ID: 24982.1079451652@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

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