pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
DataType OID for PQexecParams-call in libpq
5+ messages / 5 participants
[nested] [flat]

* DataType OID for PQexecParams-call in libpq
@ 2004-03-16 09:28 Jan Klostermann <klostermann@rhf.de>
  2004-03-16 13:36 ` Re: DataType OID for PQexecParams-call in libpq Gergely Czuczy <phoemix@harmless.hu>
  0 siblings, 1 reply; 5+ messages in thread

From: Jan Klostermann @ 2004-03-16 09:28 UTC (permalink / raw)
  To: 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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: DataType OID for PQexecParams-call in libpq
  2004-03-16 09:28 DataType OID for PQexecParams-call in libpq Jan Klostermann <klostermann@rhf.de>
@ 2004-03-16 13:36 ` Gergely Czuczy <phoemix@harmless.hu>
  2004-03-16 15:40   ` Re: DataType OID for PQexecParams-call in libpq Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Gergely Czuczy @ 2004-03-16 13:36 UTC (permalink / raw)
  To: Jan Klostermann <klostermann@rhf.de>; +Cc: 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@harmless.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
>




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: DataType OID for PQexecParams-call in libpq
  2004-03-16 09:28 DataType OID for PQexecParams-call in libpq Jan Klostermann <klostermann@rhf.de>
  2004-03-16 13:36 ` Re: DataType OID for PQexecParams-call in libpq Gergely Czuczy <phoemix@harmless.hu>
@ 2004-03-16 15:40   ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2004-03-16 15:40 UTC (permalink / raw)
  To: Gergely Czuczy <phoemix@harmless.hu>; +Cc: Jan Klostermann <klostermann@rhf.de>; pgsql-interfaces

Gergely Czuczy <phoemix@harmless.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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: DataType OID for PQexecParams-call in libpq
@ 2004-08-05 20:17 Richardson Mark <MRichardson@SpaceImaging.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Richardson Mark @ 2004-08-05 20:17 UTC (permalink / raw)
  To: pgsql-interfaces

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
Mark


********************************************************************************
This message is intended only for the use of the Addressee and may
contain information that is PRIVILEGED and CONFIDENTIAL.

If you are not the intended recipient, you are hereby notified that any
dissemination of this communication is strictly prohibited. If you have
received this communication in error, please erase all copies of the
message and its attachments and notify Space Imaging immediately.
********************************************************************************

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: DataType OID for PQexecParams-call in libpq
@ 2004-08-05 20:22 Mark Richardson <markmapo@yahoo.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Mark Richardson @ 2004-08-05 20:22 UTC (permalink / raw)
  To: pgsql-interfaces


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!

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2004-08-05 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-03-16 09:28 DataType OID for PQexecParams-call in libpq Jan Klostermann <klostermann@rhf.de>
2004-03-16 13:36 ` Gergely Czuczy <phoemix@harmless.hu>
2004-03-16 15:40   ` Tom Lane <tgl@sss.pgh.pa.us>
2004-08-05 20:17 Re: DataType OID for PQexecParams-call in libpq Richardson Mark <MRichardson@SpaceImaging.com>
2004-08-05 20:22 Re: DataType OID for PQexecParams-call in libpq Mark Richardson <markmapo@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox