Array type confusion

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Array type confusion
Date: 2000-07-05 16:36:43
Message-ID: Pine.LNX.4.21.0007051715350.347-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The question is how to determine when a type is an array type (and not
using the leading-underscore convention). A comment in pg_type.h says:

/*
* typelem is 0 if this is not an array type. If this is an array
* type, typelem is the OID of the type of the elements of the array
* (it identifies another row in Table pg_type).
*/

The reverse seems to be false. If typelem is not 0, then the type is not
necessarily an array type. For example, the typelem entries of text,
bpchar, and name point to char (the single-byte variant), while box and
lseg claim to be arrays of "point".

How should this be handled in the context of formatting the types for
reconsumption?

Appendix: The complete list of not-really-array types that have typelem
set is:

bytea => char
name => char
int2vector => int2
text => char
oidvector => oid
point => float8
lseg => point
path => point
box => point
filename => char
line => point
unknown => char
bpchar => char
varchar => char

--
Peter Eisentraut Sernanders väg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-07-05 16:37:12 Removing src/backend from include path might break on HPUX
Previous Message Peter Eisentraut 2000-07-05 16:36:33 Re: zlib for pg_dump