home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre1.z / postgre1 / test / von.c < prev   
Encoding:
C/C++ Source or Header  |  1992-08-27  |  2.8 KB  |  90 lines

  1. #ifdef NOTDEF
  2. Received: from bernina.ethz.ch by postgres.Berkeley.EDU (5.61/1.29)
  3.     id AA17395; Fri, 8 Mar 91 05:47:50 -0800
  4. Received: from neptune by bernina.ethz.ch with SMTP inbound id <29090-0@bernina.ethz.ch>; Fri, 8 Mar 1991 14:47:47 +0100
  5. From: Michael Boehlen <boehlen@inf.ethz.ch>
  6. Received: from crown (crown.inf.ethz.ch) by neptune.inf.ethz.ch id AA25978; Fri, 8 Mar 91 14:47:43 +0100
  7. Message-Id: <9103081343.AA00272@crown>
  8. Received: by crown id AA00272; Fri, 8 Mar 91 14:43:57 +0100
  9. To: postgres@postgres.Berkeley.edu
  10. Subject: integers are not properly handled in postgres (-> bget: no free buffers)
  11. Date: Fri, 08 Mar 91 14:43:54 N
  12.  
  13. I asked you a few days ago what the error message
  14.   'WARN:Mar  8 14:22:03:bget: no free buffers'
  15. means. I think I've found the bug leading to this error message.
  16.  
  17. Consider the following situation:
  18.  
  19. relation edge    von            nach
  20.                  ====================
  21.                  1              2
  22.                  2              3
  23.                  3              4
  24.                  4              5
  25.                  2              7
  26.  
  27. relation weg     von            nach
  28.                  ====================
  29.                  1              2
  30.                  2              3
  31.                  3              4
  32.                  4              5
  33.                  2              7
  34.  
  35. I'm going to compute the transitive closure by iterating the following statement
  36. sequence:
  37.  
  38.   retrieve into delta(von=edge.von,nach=weg.nach) where edge.nach=weg.von
  39.   delete delta where delta.von=weg.von and delta.nach=weg.nach"
  40.   append weg(delta.all)
  41.   destroy delta
  42.  
  43. After about 5 iteration steps postgres crashes with the error message
  44.   WARN:Mar  8 14:22:03:bget: no free buffers
  45.  
  46. Note: If I'm using type char16 (instead of int4) it works all right! I
  47. guess you don't
  48.       handle buffer deallocation the right way.
  49.  
  50. Will you fix this bug in the future?
  51.  
  52. Mike Boehlen
  53.  
  54. Below I included a copy of the program that leads to this bug
  55.  
  56. -------------------------------------------------------------------------
  57. #endif
  58.  
  59. #include <stdio.h>
  60. #include <string.h>
  61. #include "tmp/libpq.h"
  62.  
  63. char* status;
  64. int i=0;
  65.  
  66. main() {
  67.   PQsetdb("test");
  68.   while (i<30) {
  69.     status = PQexec("retrieve into delta(von=edge.von,nach=weg.nach) \
  70.                      where edge.nach=weg.von");
  71.     printf("<<<PQexec status: %s>>>\n", status);
  72.     if (*status == 'R') exit(0);
  73.  
  74.     status = PQexec("delete delta where delta.von=weg.von and delta.nach=weg.nach");
  75.     printf("<<<PQexec status: %s>>>\n", status);
  76.     if (*status == 'R') exit(0);
  77.  
  78.     status = PQexec("append weg(delta.all)");
  79.     printf("<<<PQexec status: %s>>>\n", status);
  80.     if (*status == 'R') exit(0);
  81.  
  82.     status = PQexec("destroy delta");
  83.     printf("<<<PQexec status: %s>>>\n", status);
  84.     if (*status == 'R') exit(0);
  85.  
  86.     i++;
  87.     printf("Number of iterations: %i\n\n", i);
  88.   }
  89. }
  90.