I liked option #2. I don't think the _last_ query in a rule should have any special handling.
So, to summarize #2, we have: if no INSTEAD, return value of original command if INSTEAD, return tag of original command return sum of all affected rows with the same tag return OID if all INSERTs in the rule insert only one row, else zero This INSERT behavior seems consistent with INSERTs inserting multiple rows via INSERT INTO ... SELECT: test=> create table x (y int); inseCREATE TABLE test=> insert into x select 1; INSERT 507324 1 ^^^^^^ test=> insert into x select 1 union select 2; INSERT 0 2 ^ I don't think we should add tuple counts from different commands, i.e. adding UPDATE and DELETE counts just yeilds a totally meaningless number. I don't think there is any need/desire to add additional API routines to handle multiple return values. Can I get some votes on this? We have one user very determined to get a fix, and the TODO.detail file has another user who really wants a fix. --------------------------------------------------------------------------- > Proposal #2 (author: Tom lane): > --------------------------------- > > Tom Lane's proposal, as posted on > http://candle.pha.pa.us/mhonarc/todo.detail/return/msg00012.html, > consists basically on the following: > > PQcmdStatus() ==> Should always return the same command type original > submitted by the client. > > PQcmdTuples() ==> If no INSTEAD rule, return same output as for > original command, ignoring other commands in the > rule.If there is INSTEAD rules, use result of last > command in the rewritten series, use result of last > command of same type as original command or sum up > the results of all the rewritten commands. > > (I particularly prefer the sum). > > PQoidValue() ==> If the original command was not INSERT, return 0. > otherwise, if one INSERT, return it's original > PQoidValue(). If more then one INSERT command > applied, use last or other possibilities (please > refer to the thread for details). -- Bruce Momjian | http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org