Re: Bug #771: rewrite rules on update or insert do not report errors - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug #771: rewrite rules on update or insert do not report errors
Date
Msg-id 1821.1032289242@sss.pgh.pa.us
Whole thread Raw
In response to Bug #771: rewrite rules on update or insert do not report errors  (pgsql-bugs@postgresql.org)
List pgsql-bugs
"marc persuy" <marc.persuy@wanadoo.fr> writes:
> what I mean is if I use a rule to execute any action,
> the rule should report an error to the client if, for any reason, this
> action fails.

It does.

> inserting into my_view will always return a sucess condition,
> even if you try to use it to insert a record with an already existing
> primary key.

Oh?

regression=# create table foo (f1 int primary key);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 'foo_pkey' for table 'foo'
CREATE TABLE
regression=# create view v as select * from foo;
CREATE VIEW
regression=# create rule v_ins as on insert to v do instead
regression-# insert into foo values(new.f1);
CREATE RULE
regression=# insert into v values (1);
INSERT 149486 1
regression=# insert into v values (1);
ERROR:  Cannot insert a duplicate key into unique index foo_pkey
regression=#

I don't see a problem.


            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug #771: rewrite rules on update or insert do not report errors
Next
From: Tom Lane
Date:
Subject: Re: [NOVICE] Postgres storing time in strange manner