Re: Oddities with ANYARRAY

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: Oddities with ANYARRAY
Дата
Msg-id 87odhrzquw.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Oddities with ANYARRAY  (Decibel! <decibel@decibel.org>)
Ответы Re: Oddities with ANYARRAY
Список pgsql-bugs
"Decibel!" <decibel@decibel.org> writes:

> David Fetter and I were just looking at something on IRC...
>
> decibel=# select most_common_vals[1] from pg_stats where tablename='pg_depend' and attname='classid';
> ERROR:  cannot subscript type anyarray because it is not an array
> decibel=# select most_common_freqs[1] from pg_stats where tablename='pg_depend' and attname='classid';
>  most_common_freqs
> -------------------
>              0.566
> (1 row)
>
> ISTM you'd want to be able to reference an individual element of an
> ANYARRAY... but this gets even more odd...

And what type would the result be?

But this is an odd coincidence as I was just looking at this myself to do
those histogram charts I was talking about. The solution I was going to
propose was to allow casting from anyarray to a normal array, then allow
subscripting the normal array.

I would be fine requiring the cast to be to the correct array type with a
run-time error if the type doesn't match. Or it could use the VIAIO cast which
would work as long as the input format matched. So you could always cast to
text[] even if it was an integer[] or something else originally.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Oddities with ANYARRAY
Следующее
От: "Justin Hibbits"
Дата:
Сообщение: BUG #3503: Benchmark scripts broken