Re: pg_type.typname of array types.

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Florian Pflug <fgp(at)phlo(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_type.typname of array types.
Date: 2010-12-08 13:32:10
Message-ID: AANLkTi=9LBt=yLgggzUnDghH3uhHcZStnook0w_eiM41@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hey Florian,

Thank you very much!

2010/12/8 Florian Pflug <fgp(at)phlo(dot)org>

> 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 references the 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, the name will even be correctly schema-qualified. (In
> fact, it's not the cast which does the translation but rather the implicit
> conversion 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
>
>

--
// Dmitriy.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2010-12-08 13:57:08 Solving sudoku using SQL
Previous Message Florian Pflug 2010-12-08 13:02:36 Re: pg_type.typname of array types.