Re: Is _ a supported way to create a column of array type?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Is _ a supported way to create a column of array type?
Дата
Msg-id 31659.1556226223@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Is _ a supported way to create a column of array type?  (Piotr Findeisen <piotr.findeisen@starburstdata.com>)
Ответы Re: Is _ a supported way to create a column of array type?
Список pgsql-general
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



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

Предыдущее
От: Martin Kováčik
Дата:
Сообщение: Re: analyze causes query planner to choose suboptimal plan for aselect query in separate transaction
Следующее
От: Piotr Findeisen
Дата:
Сообщение: Re: Is _ a supported way to create a column of array type?