using composite types in insert/update

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема using composite types in insert/update
Дата
Msg-id b42b73150901280903kee75173nafd9393fb24f3a17@mail.gmail.com
обсуждение исходный текст
Ответы Re: using composite types in insert/update
Re: using composite types in insert/update
Список pgsql-hackers
IMO, composite types on insert/update should work as they do on select:

SELECT foo FROM foo; -- works, returning type foo

INSERT INTO foo VALUES '(something)'::foo -- fails,

but we have a workaround:
INSERT INTO foo SELECT  ('(something)'::foo).* -- expands foo into foo columns

however no such workaround exists for update. ideally,
UPDATE foo SET foo = foo;

would be valid.  Aside from fixing a surprising behavior, it would
greatly aid in writing triggers that do things like ship updates over
dblink _much_ easier (in fact...the dblink_build_xxx family would
become obsolete).

e.g.
perform dblink.dblink('UPDATE foo SET foo = \'' || new || '\'::foo);

I call the existing behavior of insert/update of composite types
broken to the point of almost being a bug.  Fixing the above to work
would close the loop on a broad new set of things you can do with
composite types.

merlin


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg_upgrade project status
Следующее
От: Robert Treat
Дата:
Сообщение: Re: 8.4 release planning