Re: could not find array type for data type character varying[]

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: could not find array type for data type character varying[]
Дата
Msg-id 20091028153648.GR5407@samason.me.uk
обсуждение исходный текст
Ответ на could not find array type for data type character varying[]  (Viktor Rosenfeld <listuser36@googlemail.com>)
Ответы could not identify an equality operator for type annotation (Was: could not find array type for data type character varying[])  (Viktor Rosenfeld <listuser36@googlemail.com>)
Список pgsql-general
On Wed, Oct 28, 2009 at 04:17:32PM +0100, Viktor Rosenfeld wrote:
> I'm trying to aggregate a list of table attributes into an array.

I'd suggest using a tuple, arrays for things where each element means
the same thing.  I'd guess you care about the substructure (i.e. the
element has a "namespace", a "name" and a "value") and hence using an
array in the first place seems wrong.  Maybe something like:

  CREATE TYPE foo AS ( namespace TEXT, name TEXT, value TEXT );
  SELECT id, array_accum(row(a,b,c)::foo)
  FROM data
  GROUP BY id;

> Why doesn't this work?

Arrays of arrays aren't directly supported; you currently have to put
them into a tuple first.  Something like:

  CREATE TYPE bar AS ( a TEXT[] );
  SELECT array_agg(row(array['a'])::bar);

--
  Sam  http://samason.me.uk/

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: auto truncate/vacuum full
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: could not find array type for data type character varying[]