create OR REPLACE rule bug

Поиск
Список
Период
Сортировка
Искать
От
Mikael Carneholm
Тема
create OR REPLACE rule bug
Дата
Msg-id
7F10D26ECFA1FB458B89C5B4B0D72C2B0881FF@sesrv12.wirelesscar.com
Список
Дерево обсуждения
Re: create OR REPLACE rule bug "Mikael Carneholm" <Mikael.Carneholm@WirelessCar.com>
Re: create OR REPLACE rule bug Tom Lane <tgl@sss.pgh.pa.us>
I believe this is a bug:

-- OR REPLACE present
create or replace rule "mastertab_jan05_update" as
on update to mastertab where
   (NEW.datecol < '20050101' or NEW.datecol >=3D '20050201')
   and
   (OLD.datecol >=3D '20050101' and OLD.datecol < '20050201')
do instead (
   -- multiple commands
   delete from mastertab_jan05 where id =3D OLD.id;
   insert into mastertab (id, datecol) values (OLD.id, NEW.datecol);
);

=3D> ERROR:  syntax error at end of input at character 255


-- OR REPLACE not present
create rule "mastertab_jan05_update" as
on update to mastertab where
   (NEW.datecol < '20050101' or NEW.datecol >=3D '20050201')
   and
   (OLD.datecol >=3D '20050101' and OLD.datecol < '20050201')
do instead (
   -- multiple commands
   delete from mastertab_jan05 where id =3D OLD.id;
   insert into mastertab (id, datecol) values (OLD.id, NEW.datecol);
);

=3D> Query OK, 0 rows affected (0,00 sec)


-- OR REPLACE present
create or replace rule "mastertab_jan05_update" as
on update to mastertab where
   (NEW.datecol < '20050101' or NEW.datecol >=3D '20050201')
   and
   (OLD.datecol >=3D '20050101' and OLD.datecol < '20050201')
do instead (
   -- single command, no semicolon
   delete from mastertab_jan05 where id =3D OLD.id=20
);

=3D> Query OK, 0 rows affected (0,00 sec)


-- OR REPLACE present
create or replace rule "mastertab_jan05_update" as
on update to mastertab where
   (NEW.datecol < '20050101' or NEW.datecol >=3D '20050201')
   and
   (OLD.datecol >=3D '20050101' and OLD.datecol < '20050201')
do instead (
   -- single command, semicolon present
   delete from mastertab_jan05 where id =3D OLD.id;
);

=3D> ERROR:  syntax error at end of input at character 255


Ie, the "OR REPLACE" token is broken in that is doesn't work with multiple =
commands (semicolons?)


/Mikael
В списке pgsql-bugs по дате отправления
От: Tom Lane
Дата:
От: Mikael Carneholm
Дата:
Сообщение: Re: create OR REPLACE rule bug
FAQ