Re: Proposal: Solving the "Return proper effected tuple count
От | Bruce Momjian |
---|---|
Тема | Re: Proposal: Solving the "Return proper effected tuple count |
Дата | |
Msg-id | 200209090152.g891qjR02204@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Proposal: Solving the "Return proper effected tuple count from complex commands [return]" issue (Steve Howe <howe@carcass.dhs.org>) |
Ответы |
Re: Proposal: Solving the "Return proper effected tuple count from complex commands [return]" issue
|
Список | pgsql-hackers |
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 commandreturn sum of all affected rows with the same tagreturn OID if all INSERTs in therule 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 TABLEtest=> insert into x select 1;INSERT 5073241 ^^^^^^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 pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
В списке pgsql-hackers по дате отправления: