From: Tom Lane <tgl@sss.pgh.pa.us>
To: Piotr Findeisen <piotr.findeisen@starburstdata.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Is _<typename> a supported way to create a column of array type?
Date: Thu, 25 Apr 2019 17:03:43 -0400
Message-ID: <31659.1556226223@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMrFzbt_DjD1BSLOhAUgNApu8MV3CCPmbEac9FfMxOOq6GAD0g@mail.gmail.com>
References: <CAMrFzbt_DjD1BSLOhAUgNApu8MV3CCPmbEac9FfMxOOq6GAD0g@mail.gmail.com>
Piotr Findeisen <piotr.findeisen@starburstdata.com> writes:
> Internally, array types get a name in the form of `_<typename>`.
Typically, yes.
> *Can a user use `_<typename>` to define a column of array type?*
Sure ... didn't you try it?
> *Is it supported?*
Not really, because it's not guaranteed that the name looks like that.
There are various corner cases where something else would be generated,
either to avoid a collision, or because truncation is needed.
However, if you've taken the trouble to check what name actually got
assigned to the array type, it's perfectly valid to use that name.
> The reason I am asking is that e.g. int4[] and _int4 behave differently.
> Although they look the same, the have different pg_attribute.attndims.
Yeah. Nothing really cares about attndims though ... it's vestigial.
Perhaps we should remove it someday.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, piotr.findeisen@starburstdata.com
Subject: Re: Is _<typename> a supported way to create a column of array type?
In-Reply-To: <31659.1556226223@sss.pgh.pa.us>
References: <CAMrFzbt_DjD1BSLOhAUgNApu8MV3CCPmbEac9FfMxOOq6GAD0g@mail.gmail.com> <31659.1556226223@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox