Re: [HACKERS] Types

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Types
Дата
Msg-id 20545.948557376@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Types  ("Oliver Elphick" <olly@lfix.co.uk>)
Список pgsql-hackers
"Oliver Elphick" <olly@lfix.co.uk> writes:
> Michael Meskes wrote:
>> libpq gives back the internal typenumbers of the attributes. How do I know
>> which number means which type? I need to find out if the type is an array.

> If the type is 1007, then:

> template1=> select typname from pg_type where oid = 1007;
> typname
> -------
> _int4  
> (1 row)

Right...

> If the typename begins with an underscore, it is an array type.

If you are going to the trouble of looking in pg_type, then you
shouldn't rely on the convention that array type names begin with
underscores.  What you *should* do is look at the typelem field.
If that's zero, it's not an array; if nonzero, it is an array type
(and typelem gives the OID of the array elements' type).
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] Status on 7.0
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Re: vacuum timings