]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Avoid re-using output variables in new ecpg test case.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 7 Nov 2020 21:25:42 +0000 (16:25 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 7 Nov 2020 21:25:42 +0000 (16:25 -0500)
The buildfarm thinks this leads to memory stomps, though annoyingly
I can't duplicate that here.  The existing code in strings.pgc is
doing something that doesn't seem to be sanctioned at all really
by the documentation, but I'm disinclined to try to make that nicer
right now.  Let's just declare some more output variables in hopes
of working around it.

src/interfaces/ecpg/test/expected/preproc-strings.c
src/interfaces/ecpg/test/expected/preproc-strings.stderr
src/interfaces/ecpg/test/preproc/strings.h
src/interfaces/ecpg/test/preproc/strings.pgc

index f64ffbc3c2511c2e078a11d0a8aa7ec6bd50e5cc..d20abfa951fbdc7c1432392118fc07f2ba183f55 100644 (file)
                   
                   
                   
+                  
+                  
 
 #line 5 "strings.pgc"
 
 #line 1 "strings.h"
- char * s1 , * s2 , * s3 , * s4 , * s5 , * s6 ;
+ char * s1 , * s2 , * s3 , * s4 , * s5 , * s6 , * s7 , * s8 ;
 /* exec sql end declare section */
 #line 5 "strings.pgc"
 
@@ -64,14 +66,14 @@ int main(void)
   printf("%s %s %s %s %s %s\n", s1, s2, s3, s4, s5, s6);
 
   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select b'0010' , x'019ABcd'", ECPGt_EOIT, 
-       ECPGt_char,&(s1),(long)0,(long)1,(1)*sizeof(char), 
+       ECPGt_char,&(s7),(long)0,(long)1,(1)*sizeof(char), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 
-       ECPGt_char,&(s2),(long)0,(long)1,(1)*sizeof(char), 
+       ECPGt_char,&(s8),(long)0,(long)1,(1)*sizeof(char), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
 #line 26 "strings.pgc"
 
 
-  printf("%s %s\n", s1, s2);
+  printf("%s %s\n", s7, s8);
 
   { ECPGdisconnect(__LINE__, "CURRENT");}
 #line 30 "strings.pgc"
index 607f8bc832620edfbcd7bd9f33a552441da6bd17..c6b71a33b993ff11be723378e9e6c19d5cf50fcb 100644 (file)
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_process_output on line 25: correctly got 1 tuples with 2 fields
 [NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 25: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_get_data on line 25: RESULT: 0010 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_store_result on line 25: allocating memory for 1 tuples
+[NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_get_data on line 25: RESULT: 0000000110011010101111001101 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_finish: connection ecpg1_regression closed
index 07c04f9103972264ec00c03f21193a2f93cf0ed8..edb5be5339e6dc236ebeb837bfb08371f5f1b12b 100644 (file)
@@ -3,4 +3,6 @@ char       *s1,
                   *s3,
                   *s4,
                   *s5,
-                  *s6;
+                  *s6,
+                  *s7,
+                  *s8;
index 3666c3e865bd419b8c9abf1bab45fcda575fb3c5..2968d5464ae3b10c5e6a40158031cc6f07748da5 100644 (file)
@@ -23,9 +23,9 @@ int main(void)
   printf("%s %s %s %s %s %s\n", s1, s2, s3, s4, s5, s6);
 
   exec sql select b'0010', X'019ABcd'
-                  into :s1, :s2;
+                  into :s7, :s8;
 
-  printf("%s %s\n", s1, s2);
+  printf("%s %s\n", s7, s8);
 
   exec sql disconnect;
   return 0;