Coax <coax@shell1.cornernet.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-# ;
> UPDATE 0
> 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