Re: getting datatype of array elements

Lists: pgsql-general
From: Moritz Sinn <moritz(at)freesources(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: getting datatype of array elements
Date: 2002-12-13 22:53:21
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-general


hi,

with the following statement, i get the datatype of a column with help of
its name and the tableoid:

SELECT typname FROM pg_attribute LEFT JOIN pg_type ON atttypid=typelem
WHERE attrelid=18210 AND attname='email';

but if the columns datatyp is an array, that doesn't work.
i'd like to get the basic datatype (the datatype of the array elements) then.

any ideas?

thanks,
moritz

--


From: Joe Conway <mail(at)joeconway(dot)com>
To: Moritz Sinn <moritz(at)freesources(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: getting datatype of array elements
Date: 2002-12-14 02:49:59
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-general

Moritz Sinn wrote:
> hi,
>
> with the following statement, i get the datatype of a column with help of
> its name and the tableoid:
>
> SELECT typname FROM pg_attribute LEFT JOIN pg_type ON atttypid=typelem
> WHERE attrelid=18210 AND attname='email';
>
> but if the columns datatyp is an array, that doesn't work.
> i'd like to get the basic datatype (the datatype of the array elements) then.

See typelem:
http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/catalog-pg-type.html

HTH,

Joe