From: | pgsql-bugs(at)postgresql(dot)org |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Bug #751: LASTOID in 7.2.1 with INSERT RULES ON VIEWS |
Date: | 2002-08-28 17:23:41 |
Message-ID: | 20020828172341.1779C475BAA@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Toni Garcia (agarcia(at)at4(dot)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 first command.
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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-08-28 18:00:34 | Re: cube bug accepting -.1 |
Previous Message | Bruno Wolff III | 2002-08-28 17:05:33 | Re: c.h needed in Pg.c |