Bug #751: LASTOID in 7.2.1 with INSERT RULES ON VIEWS

Поиск
Список
Период
Сортировка
От pgsql-bugs@postgresql.org
Тема Bug #751: LASTOID in 7.2.1 with INSERT RULES ON VIEWS
Дата
Msg-id 20020828172341.1779C475BAA@postgresql.org
обсуждение исходный текст
Список pgsql-bugs
Toni Garcia (agarcia@at4.net) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
LASTOID in 7.2.1 with INSERT RULES ON VIEWS

Long Description
This fix on 7.2.1 has apparently changed the OID that is returned
with ON INSERT rules:

- Return proper OID on command completion even with ON INSERT rules (Tom)

The 7.2.1 behaivour (returning the OID generated by the first command) is good for rules ON INSERT on tables with
no DO INSTEAD command but i think it makes no sense for view rules or DO INSTEAD rules where there is no OID for the
firstcommand. 



Sample Code
CREATE table myobject (
   name varchar(32) PRIMARY KEY,
   aproperty varchar(32),
   anotherproperty varchar(32)
);

CREATE table myimage (
   name varchar(32) PRIMARY KEY,
   image oid,
   CONSTRAINT FK_obj_ima_1 FOREIGN KEY (name) REFERENCES myobject(name) ON UPDATE CASCADE ON DELETE CASCADE
);

CREATE VIEW myimage_obj AS
select i.oid, i.*, o.aproperty, o.anotherproperty from myimage i, myobject o where i.name = o.name;

CREATE RULE myimage_ins AS
    ON INSERT TO myimage_obj
    DO INSTEAD
        (
        INSERT into myobject
            (name, aproperty, anotherproperty)
            values (NEW.name, NEW.aproperty, NEW.anotherproperty);
        INSERT into myimage
            (name, image)
            values (NEW.name, NEW.image);
        );
----

this used to return myimage's oid (last inserted oid) on 7.2.0:

=# INSERT INTO myimage_obj (name, aproperty) values ('mygif', 'verybig');
INSERT 0 0

No file was uploaded with this report

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: c.h needed in Pg.c
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: cube bug accepting -.1