update ARRAY of COMPOSITE TYPE of text

Поиск
Список
Период
Сортировка
От Wojciech Skaba
Тема update ARRAY of COMPOSITE TYPE of text
Дата
Msg-id 519DE415.2070207@teleadreson.pl
обсуждение исходный текст
Ответы Re: update ARRAY of COMPOSITE TYPE of text  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I did:

CREATE TYPE telephone AS (
area text,
number text,
ext text
);

Then:

CREATE TABLE directory (
id integer,
tel telephone,
faxes telephone[]
);

After some data has been entered, I tried:

UPDATE directory SET tel = ROW('11', '2222222', '333') WHERE id = 1;
UPDATE directory SET faxes[1] = ROW('11', '2222222', '333') WHERE id = 1;

both worked fine, but:

UPDATE directory SET faxes = ARRAY[ROW('11', '2222222', '333'), ROW('44', '555', '666')] WHERE id = 1;

has failed: (You will need to rewrite or cast the expression) with arrow pointing to ARRAY.

Does anybody know how to overcome it?

Please note, I'm not seeking an alternative, as I can still do the following:

UPDATE directory SET faxes = '{(11\,2222222\,333),(44\,555\,666)}' WHERE id=1;

I would like, however, do the same with ARRAY/ROW.

W



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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: [pgeu-general] Replication failover
Следующее
От: Neeraj Rai
Дата:
Сообщение: - pgaql long value corrupted using htons