Re: Re: [HACKERS] Outstanding patches - Mailing list pgsql-jdbc

From Bruce Momjian
Subject Re: Re: [HACKERS] Outstanding patches
Date
Msg-id 200106070008.f57083G28044@candle.pha.pa.us
Whole thread Raw
In response to Re: Re: [HACKERS] Outstanding patches  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-jdbc
> > +            /* 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);
>
> I do not think it is a good idea to return a negative count for a
> backwards move; that is too likely to break client code that parses
> command result strings and isn't expecting minus signs.  The client
> should know whether he issued MOVE FORWARD or MOVE BACKWARDS anyway,
> so just returning es_processed ought to be sufficient.
>
> Otherwise I think the patch is probably OK.

I have applied this patch with does MOVE output for both the backend and
jdbc.  I tested the JDBC patch by compiling, and changed the backend to
only output postitive values.

Thanks.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/backend/commands/command.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/commands/command.c,v
retrieving revision 1.131
diff -c -r1.131 command.c
*** src/backend/commands/command.c    2001/05/30 13:00:03    1.131
--- src/backend/commands/command.c    2001/06/07 00:03:44
***************
*** 176,181 ****
--- 176,187 ----
          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)
***************
*** 187,192 ****
--- 193,204 ----
          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, estate->es_processed);
              if (estate->es_processed > 0)
                  portal->atEnd = false;    /* OK to go forward now */
              if (count <= 0 || (int) estate->es_processed < count)
Index: src/interfaces/jdbc/org/postgresql/Connection.java
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Connection.java,v
retrieving revision 1.16
diff -c -r1.16 Connection.java
*** src/interfaces/jdbc/org/postgresql/Connection.java    2001/06/01 20:57:58    1.16
--- src/interfaces/jdbc/org/postgresql/Connection.java    2001/06/07 00:03:56
***************
*** 505,511 ****
                  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")){ 
                      try {
                          update_count = Integer.parseInt(recv_status.substring(1+recv_status.lastIndexOf(' ')));
                      } catch(NumberFormatException nfe) {
--- 505,511 ----
                  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")|| recv_status.startsWith("MOVE")) { 
                      try {
                          update_count = Integer.parseInt(recv_status.substring(1+recv_status.lastIndexOf(' ')));
                      } catch(NumberFormatException nfe) {

pgsql-jdbc by date:

Previous
From: Bruce Momjian
Date:
Subject: Finalize large object patch
Next
From: Joseph Shraibman
Date:
Subject: Re: jdbc3