Re: pg_type.typname of array types. - Mailing list pgsql-hackers

From Dmitriy Igrishin
Subject Re: pg_type.typname of array types.
Date
Msg-id AANLkTi=9LBt=yLgggzUnDghH3uhHcZStnook0w_eiM41@mail.gmail.com
Whole thread Raw
In response to Re: pg_type.typname of array types.  (Florian Pflug <fgp@phlo.org>)
List pgsql-hackers
Hey Florian,<br /><br />Thank you very much!<br /><br /><div class="gmail_quote">2010/12/8 Florian Pflug <span
dir="ltr"><<ahref="mailto:fgp@phlo.org">fgp@phlo.org</a>></span><br /><blockquote class="gmail_quote"
style="margin:0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On
Dec8,2010, at 11:35 , Dmitriy Igrishin wrote:<br /> > Is it guaranteed that name of array types in pg_type system<br
/>> catalog will always be prefixed by underscore or this convention<br /> > can be changed in future ?<br /><br
/></div>What'sthe advantage of letting your code depend on this?<br /><br /> Within SQL, I suggest you write
<type>[]to denote <type>'s array type. In the catalog, each pg_type row contains a references the
correspondingarray type (by OID) in the field "typarray".<br /><br /> BTW, when querying pg_type, instead of adding
anotherjoin to pg_type to get the array type's name, you can simply cast the "typarray" field to "regtype". That way,
shouldthe 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
tocstring that happens when the result is transferred to the client. For further information, you might want to check
outthe documentation of the various reg* types provided by postgres).<br /><br /> Hope that helps,<br /><font
color="#888888">FlorianPflug<br /><br /></font></blockquote></div><br /><br clear="all" /><br />-- <br />// Dmitriy.<br
/><br/><br /> 

pgsql-hackers by date:

Previous
From: Florian Pflug
Date:
Subject: Re: pg_type.typname of array types.
Next
From: Tatsuo Ishii
Date:
Subject: Solving sudoku using SQL