Thread: pg_exec not returning after 16 calls/ libpgtcl

pg_exec not returning after 16 calls/ libpgtcl

From
g.hintermayer@inode.at (Gerhard Hintermayer)
Date:
Sorry if posted twice, got not confirmation about posting from google.

Obviously noone has ever tested the doubling of availiable result ids
up to
reaching the hard limit. After opening 16(=current REST_START value)
results via pg_exec, the next pg_exec tries to find an empty slot
forever :-( . In PgSetResultId file pgtclId.c in the for loop there
has to be done a break, if res_max ist reached. The piece of code
should look like       if (resid == connid->res_max)       {           resid = 0;           break;   /* the break as to
beadded */       }
 

now everything works (double available results after reaching
RES_START up to reaching RES_HARD_MAX)

PS: sorry, posting via Google, so no attached diff available

regards

Gerhard Hintermayer
http://www.inode.at/g.hintermayer


Re: pg_exec not returning after 16 calls/ libpgtcl

From
Bruce Momjian
Date:
I assume the attached patch is what you are suggesting.  Applied.

---------------------------------------------------------------------------

Gerhard Hintermayer wrote:
> Sorry if posted twice, got not confirmation about posting from google.
>
> Obviously noone has ever tested the doubling of availiable result ids
> up to
> reaching the hard limit. After opening 16(=current REST_START value)
> results via pg_exec, the next pg_exec tries to find an empty slot
> forever :-( . In PgSetResultId file pgtclId.c in the for loop there
> has to be done a break, if res_max ist reached. The piece of code
> should look like
>         if (resid == connid->res_max)
>         {
>             resid = 0;
>             break;   /* the break as to be added */
>         }
>
> now everything works (double available results after reaching
> RES_START up to reaching RES_HARD_MAX)
>
> PS: sorry, posting via Google, so no attached diff available
>
> regards
>
> Gerhard Hintermayer
> http://www.inode.at/g.hintermayer
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
  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, Pennsylvania 19073
Index: src/interfaces/libpgtcl/pgtclId.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/libpgtcl/pgtclId.c,v
retrieving revision 1.35
diff -c -c -r1.35 pgtclId.c
*** src/interfaces/libpgtcl/pgtclId.c    4 Sep 2002 20:31:46 -0000    1.35
--- src/interfaces/libpgtcl/pgtclId.c    23 Sep 2002 01:41:42 -0000
***************
*** 343,349 ****
--- 343,352 ----
      for (resid = connid->res_last + 1; resid != connid->res_last; resid++)
      {
          if (resid == connid->res_max)
+         {
              resid = 0;
+             break;
+         }
          if (!connid->results[resid])
          {
              connid->res_last = resid;