Array type confusion - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Array type confusion
Date
Msg-id Pine.LNX.4.21.0007051715350.347-100000@localhost.localdomain
Whole thread Raw
Responses Re: Array type confusion  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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
elementsof 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@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: fcntl(F_SETLK)
Next
From: Peter Eisentraut
Date:
Subject: Re: zlib for pg_dump