Skip site navigation (1) Skip section navigation (2)

Re: Possible bug concerning LASTOID in 7.2

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Coax <coax(at)shell1(dot)cornernet(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, Fernando Nasser <fnasser(at)redhat(dot)com>
Subject: Re: Possible bug concerning LASTOID in 7.2
Date: 2002-02-25 23:29:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
Coax <coax(at)shell1(dot)cornernet(dot)com> writes:
> [ insert with an ON INSERT DO UPDATE ... rule ]

> Here's the output of PG7.1.2:
> test=# INSERT INTO forum (group_forum_id,posted_by,subject,body,date,is_followup_to,thread_id,most_recent_date) VALUES ('88760', '192470', 'asdfasdfsqdf', 'blah', '1014405669','0','625864','1014405669');
> INSERT 80942390 1
> test=# \echo :LASTOID
> 80942390

> However, here's the output from PG7.2:

> test=# INSERT INTO forum (group_forum_id,posted_by,subject,body,date,is_followup_to,thread_id,most_recent_date) VALUES ('88760', '192470', 'asdfasdfsqdf', 'blah', '1014405669','0','625864','1014405669')
> test-# ;
> test=# \echo :LASTOID
> 0

I suspect the proximate cause of this is that we changed 7.2 so that
rule actions for an INSERT are done after the INSERT, not beforehand.
This is a good idea from most points of view, but it's annoying that
it's affecting the returned command tag.  I tend to agree that that's
a bug, and that the tag ought to reflect the given command not any
queries generated by rules.  However, it might be difficult to fix.

Fernando, does your command-tag patch help with this at all?

Another thing to think about: if the given query is suppressed entirely
by an ON INSERT DO INSTEAD rule, what tag should be returned?

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: JustinDate: 2002-02-26 03:58:18
Subject: Re: Full bug list
Previous:From: Tom LaneDate: 2002-02-25 18:55:44
Subject: Re: missing foreign key fails silently using COPY

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group