Message of move - Mailing list pgsql-hackers
From | Kovacs Baldvin |
---|---|
Subject | Message of move |
Date | |
Msg-id | Pine.GSO.4.21.0104072201130.27305-200000@ural2 Whole thread Raw |
List | pgsql-hackers |
Hi. A few weeks (months?) ago I made a patch to the postgres backend to get back the number of realized moves after a MOVE command. So if I issue a "MOVE 100 IN cusrorname", but there was only 66 rows left, I get back not only "MOVE", but "MOVE 66". If the 100 steps could be realized, then "MOVE 100" would come back. I send this info to you, because I would like to ask you if it could be OK to include in future versions. I think you are in a beta testing phase now, so it is trivially not the time to include it now... The solution is 2 code lines into command.c, and then the message of move cames with the number into for example psql. 1 other word into the jdbc driver, and this number is available at update_count. I made the patch to the latest (one day old) CVS version. Here are the patches. Please look at them, and if you think it's a good idea, then please let me know where and how should I post them, and approximately when will you finish with the beta testing, so it can be really considered seriously. I included them also as an attachment, because my silly pine insists to break the lines... --- ./src/backend/commands/command.c.orig Fri Mar 23 05:49:52 2001 +++ ./src/backend/commands/command.c Sat Apr 7 10:24:27 2001 @@ -174,6 +174,12 @@ if (!portal->atEnd) { ExecutorRun(queryDesc, estate, EXEC_FOR, (long) count); + + /* I use CMD_UPDATE, because no CMD_MOVE or the like + exists, and I would like to provide the same + kind of info as CMD_UPDATE */ + UpdateCommandInfo(CMD_UPDATE, 0, estate->es_processed); + if (estate->es_processed > 0) portal->atStart = false; /* OK to back up now */ if (count <= 0 || (int) estate->es_processed < count) @@ -185,6 +191,12 @@ if (!portal->atStart) { ExecutorRun(queryDesc, estate, EXEC_BACK, (long) count); + + /* I use CMD_UPDATE, because no CMD_MOVE or the like + exists, and I would like to provide the same + kind of info as CMD_UPDATE */ + UpdateCommandInfo(CMD_UPDATE, 0, -1*estate->es_processed); + if (estate->es_processed > 0) portal->atEnd = false; /* OK to go forward now */ if (count <= 0 || (int) estate->es_processed < count) Here is the patch for the jdbc driver. >! I couldn't test it with the current version, because it needs ant, and I didn't have time and money today to download it... !< However, it is a trivial change, and if Peter T. Mount reads it, I ask him to check if he likes it... Thanks for any kind of answer. --- ./src/interfaces/jdbc/org/postgresql/Connection.java.orig Wed Jan 31 09:26:01 2001 +++ ./src/interfaces/jdbc/org/postgresql/Connection.java Sat Apr 7 16:42:04 2001 @@ -490,7 +490,7 @@ recv_status = pg_stream.ReceiveString(receive_sbuf,8192,getEncoding()); // Now handle the update count correctly. - if(recv_status.startsWith("INSERT") || recv_status.startsWith("UPDATE") || recv_status.startsWith("DELETE")){ + if(recv_status.startsWith("INSERT") || recv_status.startsWith("UPDATE") || recv_status.startsWith("DELETE")|| recv_status.startsWith("MOVE")) { try { update_count= Integer.parseInt(recv_status.substring(1+recv_status.lastIndexOf(' '))); } catch(NumberFormatExceptionnfe) { ------------------- (This last looks a bit complex, but the change is really a new "|| recv_status.startsWith("MOVE")" only...) Thank you for having read this, Baldvin p.s.: I read a page on your homepage, called "unapplied patches". I would like to know if it means "still unapplied patches", or it means "bad, and not accepted ideas".
pgsql-hackers by date: