Re: Bug #771: rewrite rules on update or insert do not report errors

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "marc persuy" <marc(dot)persuy(at)wanadoo(dot)fr>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #771: rewrite rules on update or insert do not report errors
Date: 2002-09-17 19:00:42
Message-ID: 1821.1032289242@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"marc persuy" <marc(dot)persuy(at)wanadoo(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2002-09-17 19:14:54 Re: [NOVICE] Postgres storing time in strange manner
Previous Message Tom Lane 2002-09-17 14:32:03 Re: Bug #771: rewrite rules on update or insert do not report errors