Re: RETURNING and DO INSTEAD ... Intentional or not?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: RETURNING and DO INSTEAD ... Intentional or not?
Дата
Msg-id 24374.1189618764@sss.pgh.pa.us
обсуждение исходный текст
Ответ на RETURNING and DO INSTEAD ... Intentional or not?  (Josh Berkus <josh@agliodbs.com>)
Ответы Re: RETURNING and DO INSTEAD ... Intentional or not?  (Josh Berkus <josh@agliodbs.com>)
Re: RETURNING and DO INSTEAD ... Intentional or not?  (Richard Huxton <dev@archonet.com>)
Список pgsql-hackers
Josh Berkus <josh@agliodbs.com> writes:
> A Hibernate developer pointed out the following odd behavior to me in 8.2.1:

> create table test ( test1 text );
> create table test2 ( test_col text );
> create rule test_insert as on insert to test do instead insert into test2 
> values ( NEW.test1 ) RETURNING test2.test_col;

> postgres=# insert into test values ( 'joe' );
> INSERT 0 1

> ... no RETURNING.

It would surely be quite broken for an INSERT that has *not* got a
returning clause to spit data at you, don't you think?

What the RETURNING clause in the rule does is let you define the data
that should be returned if the rewritten INSERT had a returning clause
to start with.
        regards, tom lane


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

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: RETURNING and DO INSTEAD ... Intentional or not?
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: RETURNING and DO INSTEAD ... Intentional or not?