Re: accessing anyarray elements

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: accessing anyarray elements
Дата
Msg-id 10198.1244902631@sss.pgh.pa.us
обсуждение исходный текст
Ответ на accessing anyarray elements  (Michael Glaesemann <grzm@seespotcode.net>)
Список pgsql-general
Michael Glaesemann <grzm@seespotcode.net> writes:
> I'd like to be able to access individual elements of anyarray,
> treating them as type anyelement to take advantage of the
> polymorphism. Using pg_stats.histogram_bounds as a convenient example
> of an anyelement array, here's an example of the issue I'm running into.

The problem with histogram_bounds is that there isn't any way to
infer an element type for it in the abstract, and thus also no way to
know what type anyelement is.  When looking at an individual row you can
know that it must have the type of the associated column and explain
that to the parser via an explicit cast, but there's pretty much no hope
of having that happen automagically.

There are a few other problems, like array columns --- the contents of
pg_statistic for them is actually an array of arrays, which simply
has not got a representation in our type system.

So you're pretty much out of luck.  I think the only meaningful thing
you can do with it in SQL is cast to text.

            regards, tom lane

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

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: How to store text files in the postgresql?
Следующее
От: Toomas Vendelin
Дата:
Сообщение: Escaping regular expressions in plperl