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

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RETURNING and DO INSTEAD ... Intentional or not?
Date: 2007-09-12 16:52:49
Message-ID: 46E81961.7000305@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Josh Berkus wrote:
> All,
>
> 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. In fact, there doesn't seem to be any way to capture the
> RETURNING output if you have a DO INSTEAD rule on an insert. Is this
> intentional, or a bug?

I think this is a side effect of rules. I seem to remember that creating
update view with rules is broken in a similar fashion.

Sincerely,

Joshua D. Drake

- --

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 24x7/Emergency: +1.800.492.2240
PostgreSQL solutions since 1997 http://www.commandprompt.com/
UNIQUE NOT NULL
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG6BlhATb/zqfZUUQRAntqAJ9rmCeX7t/23i5NIW1PpWIi8HGm/ACgkaMg
k+VQip5jZolm+Xs7BsiZwkw=
=hdNt
-----END PGP SIGNATURE-----

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-09-12 17:39:24 Re: RETURNING and DO INSTEAD ... Intentional or not?
Previous Message Florian G. Pflug 2007-09-12 16:49:05 Re: A small mistake in the initial latestCompletedXid idea