dbTalk Databases Forums  

Re: how are the oids or arrays defined?

comp.databases.postgresql comp.databases.postgresql


Discuss Re: how are the oids or arrays defined? in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: how are the oids or arrays defined? - 11-10-2006 , 03:57 AM






Sascha Bohnenkamp <bohnenkamp (AT) mevisbreastcare (DOT) de> wrote:
Quote:
I want to use arrays to ease usage of some of our applications data.

I was able to figure out the OIDs of the primitive datatypes like
timestamp, integer etc. using the table pg_type.

But as soon as i use arrays I get OIDs from libpq which are not in
pg_type like 1115,1007,1022,1015

ok so where are the OIDs of arrays defined or how are they computed?
If you are looking for a C header file, it is
<postgres>/include/server/catalog/pg_type.h
Unfortunately the only array type that has a #define for its OID is
INT4ARRAYOID.

The name of the type for int4[] is '_int4', for bytea[] it is '_bytea' etc.

You can query the table pg_catalog.pg_type for the information you want:

select oid from pg_catalog.pg_type where typname='_int4';

These OIDs are the same for all PostgreSQL servers.
I think that it is theoretically possible that they may change from one
PostgreSQL version to the other, but I don't think that this will ever
happen.

Yours,
Laurenz Albe


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.