From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kris Jurka <books@ejurka.com>
Cc: dmp <danap@ttc-cmc.net>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Array Char/VarChar Size
Date: Fri, 29 Feb 2008 13:44:27 -0500
Message-ID: <10183.1204310667@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.BSO.4.64.0802291248520.30295@leary.csoft.net>
References: <47C512CA.9010808@ttc-cmc.net>
<47C8419F.2060909@ttc-cmc.net>
<Pine.BSO.4.64.0802291248520.30295@leary.csoft.net>
Kris Jurka <books@ejurka.com> writes:
> Multi-dimensional array information is not stored. Every array type may
> be any number of dimensions. The precision information is not available
> in the information_schema, but it is available in the system catalog
> tables. See pg_attribute.atttypmod, but it does require some decoding.
Rather than embedding knowledge of typmod encoding in client-side code,
may I suggest using the format_type function? For example
select format_type(atttypid, atttypmod) from pg_attribute where
attrelid = 'my_table'::regclass and attname = 'my_column';
This will give you back something reasonably standardized, like
"character varying(42)[]". You'll still need a bit of logic to
extract what you want, but it seems much less likely to break.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: tgl@sss.pgh.pa.us, books@ejurka.com, danap@ttc-cmc.net
Subject: Re: Array Char/VarChar Size
In-Reply-To: <10183.1204310667@sss.pgh.pa.us>
References: <47C512CA.9010808@ttc-cmc.net> <47C8419F.2060909@ttc-cmc.net> <Pine.BSO.4.64.0802291248520.30295@leary.csoft.net> <10183.1204310667@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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