Re: WIP: Triggers on VIEWs
Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>
From: Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>
To: Bernd Helmle <mailings@oopsware.de>
Cc: Dean Rasheed <dean.a.rasheed@gmail.com>,
pgsql-hackers@postgresql.org
Date: 2010-09-22T23:26:45Z
Lists: pgsql-hackers
On 2010-09-23 1:16 AM, Bernd Helmle wrote:
> INSERT INTO vfoo VALUES('helmle', 2) RETURNING *;
> text | id
> --------+----
> helmle | 2
> (1 row)
>
> SELECT * FROM vfoo;
> text | id
> -------+----
> bernd | 2
> (1 row)
>
> This is solvable by a properly designed trigger function, but maybe we need
> to do something about this?
I really don't think we should limit what people are allowed to do in
the trigger function.
Besides, even if the RETURNING clause returned 'bernd' in the above
case, I think it would be even *more* surprising. The trigger function
explicitly returns NEW which has 'helmle' as the first field.
Regards,
Marko Tiikkaja