pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedView INSERTs not returning OID in Postgres 7.2.1
2+ messages / 2 participants
[nested] [flat]
* View INSERTs not returning OID in Postgres 7.2.1
@ 2002-04-10 21:40 Damon Cokenias <lists@mtn-palace.com>
0 siblings, 1 reply; 2+ messages in thread
From: Damon Cokenias @ 2002-04-10 21:40 UTC (permalink / raw)
To: pgsql-general@postgresql.org
I recently moved from 7.1.3 to 7.2.1. In doing so, my application broke. It relies on INSERT returning the OID of the inserted row, even if the INSERT was on a view. I saw a note in the 7.2.1 notes about fixing a problem in this area, perhaps more needs to be done?
Example:
acropolis=# create table shad (a integer);
CREATE
acropolis=# create view shadview as select * from shad;
CREATE
acropolis=# create rule shadview_insert as on insert to shadview do instead insert into shad values (new.a);
CREATE
acropolis=# insert into shad values (1);
INSERT 3876425 1
acropolis=# insert into shadview values (2);
INSERT 0 0
acropolis=# select * from shad;
a
---
1
2
(2 rows)
---------------
Shouldn't the second INSERT return an OID as well?
Thanks,
-Damon
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: View INSERTs not returning OID in Postgres 7.2.1
@ 2002-04-11 02:10 Tom Lane <tgl@sss.pgh.pa.us>
parent: Damon Cokenias <lists@mtn-palace.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2002-04-11 02:10 UTC (permalink / raw)
To: Damon Cokenias <lists@mtn-palace.com>; +Cc: pgsql-general@postgresql.org
Damon Cokenias <lists@mtn-palace.com> writes:
> I recently moved from 7.1.3 to 7.2.1. In doing so, my application
> broke. It relies on INSERT returning the OID of the inserted row,
> even if the INSERT was on a view.
I'm afraid you were relying on a coincidental artifact of the old
implementation, namely that you got back the command tag associated
with the last command to be physically executed. The current code
is careful to return the command tag associated with the original
query (here, the insert into shadview) regardless of execution order
of additional queries executed by rules. I'm not sure that we can fix
your problem without breaking other cases.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-04-11 02:10 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-10 21:40 View INSERTs not returning OID in Postgres 7.2.1 Damon Cokenias <lists@mtn-palace.com>
2002-04-11 02:10 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox