Re: pg_type.typname of array types.

Поиск
Список
Период
Сортировка
От Florian Pflug
Тема Re: pg_type.typname of array types.
Дата
Msg-id 981AEB42-0CCB-43F9-AB0D-BC13728E6D5C@phlo.org
обсуждение исходный текст
Ответ на pg_type.typname of array types.  (Dmitriy Igrishin <dmitigr@gmail.com>)
Ответы Re: pg_type.typname of array types.  (Dmitriy Igrishin <dmitigr@gmail.com>)
Список pgsql-hackers
On Dec8, 2010, at 11:35 , Dmitriy Igrishin wrote:
> Is it guaranteed that name of array types in pg_type system
> catalog will always be prefixed by underscore or this convention
> can be changed in future ?

What's the advantage of letting your code depend on this?

Within SQL, I suggest you write <type>[] to denote <type>'s array type. In the catalog, each pg_type row contains a
referencesthe corresponding array type (by OID) in the field "typarray". 

BTW, when querying pg_type, instead of adding another join to pg_type to get the array type's name, you can simply cast
the"typarray" field to "regtype". That way, should the array type happen to lie in a schema not in your search_path,
thename will even be correctly schema-qualified. (In fact, it's not the cast which does the translation but rather the
implicitconversion from regtype to cstring that happens when the result is transferred to the client. For further
information,you might want to check out the documentation of the various reg* types provided by postgres). 

Hope that helps,
Florian Pflug



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

Предыдущее
От: Marko Tiikkaja
Дата:
Сообщение: Re: wCTE behaviour
Следующее
От: Dmitriy Igrishin
Дата:
Сообщение: Re: pg_type.typname of array types.