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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bug #771: rewrite rules on update or insert do not report errors
Дата
Msg-id 1821.1032289242@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Bug #771: rewrite rules on update or insert do not report errors  (pgsql-bugs@postgresql.org)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Bug #771: rewrite rules on update or insert do not report errors
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [NOVICE] Postgres storing time in strange manner