Re: [Bug Fix]ECPG: cancellation of significant digits on ECPG

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [Bug Fix]ECPG: cancellation of significant digits on ECPG
Дата
Msg-id 8107.1542064040@sss.pgh.pa.us
обсуждение исходный текст
Ответ на RE: [Bug Fix]ECPG: cancellation of significant digits on ECPG  ("Higuchi, Daisuke" <higuchi.daisuke@jp.fujitsu.com>)
Ответы RE: [Bug Fix]ECPG: cancellation of significant digits on ECPG  ("Higuchi, Daisuke" <higuchi.daisuke@jp.fujitsu.com>)
Список pgsql-hackers
"Higuchi, Daisuke" <higuchi.daisuke@jp.fujitsu.com> writes:
> From: Dmitry Dolgov [mailto:9erthalion6@gmail.com]
>> Thanks for the patches. Unfortunately, judging from the cfbot.cputube.org they
>> can't be applied anymore to the current master, could you please rebase them?

> Thank you for checking!
> I rebased patches on the current master, so I attach them.

I took a quick look at this.  I concur that the code is broken as-is;
it's failing to reproduce the state of the digit buffer accurately.
However, I think there's a second bug, which is that it doesn't even
try to duplicate the state when ndigits = 0.  That basically means that
the sqlda area might contain dangling pointers (they'll point to the
PGTYPESnumeric_from_asc output, which is freed immediately after we
set up the sqlda copy).  Now *maybe* that doesn't lead to any obvious
problem, but I don't think that this code deserves any expectation of
correctness given that you just found such a large bug in it.  So
I think that we ought to unconditionally make the sqlda value's digit
buffer look just like the one we're copying, even when ndigits = 0,
which just requires removing the tests on ndigits.

I also noted that the comment adjacent to this code was badly obsolete.

In short, the attached.  (I didn't bother to keep the test changes
separate from the code fix.)

            regards, tom lane

diff --git a/src/interfaces/ecpg/ecpglib/sqlda.c b/src/interfaces/ecpg/ecpglib/sqlda.c
index 317d22f..3f86af3 100644
--- a/src/interfaces/ecpg/ecpglib/sqlda.c
+++ b/src/interfaces/ecpg/ecpglib/sqlda.c
@@ -107,9 +107,12 @@ sqlda_common_total_size(const PGresult *res, int row, enum COMPAT_MODE compat, l
             case ECPGt_numeric:

                 /*
-                 * Let's align both the numeric struct and the digits array to
-                 * int Unfortunately we need to do double work here to compute
-                 * the size of the space needed for the numeric structure.
+                 * We align the numeric struct to allow it to store a pointer,
+                 * while the digits array is aligned to int (which seems like
+                 * overkill, but let's keep compatibility here).
+                 *
+                 * Unfortunately we need to deconstruct the value twice to
+                 * find out the digits array's size and then later fill it.
                  */
                 ecpg_sqlda_align_add_size(offset, sizeof(NumericDigit *), sizeof(numeric), &offset, &next_offset);
                 if (!PQgetisnull(res, row, i))
@@ -120,8 +123,7 @@ sqlda_common_total_size(const PGresult *res, int row, enum COMPAT_MODE compat, l
                     num = PGTYPESnumeric_from_asc(val, NULL);
                     if (!num)
                         break;
-                    if (num->ndigits)
-                        ecpg_sqlda_align_add_size(next_offset, sizeof(int), num->ndigits + 1, &offset, &next_offset);
+                    ecpg_sqlda_align_add_size(next_offset, sizeof(int), num->digits - num->buf + num->ndigits,
&offset,&next_offset); 
                     PGTYPESnumeric_free(num);
                 }
                 break;
@@ -345,14 +347,11 @@ ecpg_set_compat_sqlda(int lineno, struct sqlda_compat **_sqlda, const PGresult *

                     memcpy(sqlda->sqlvar[i].sqldata, num, sizeof(numeric));

-                    if (num->ndigits)
-                    {
-                        ecpg_sqlda_align_add_size(next_offset, sizeof(int), num->ndigits + 1, &offset, &next_offset);
-                        memcpy((char *) sqlda + offset, num->buf, num->ndigits + 1);
+                    ecpg_sqlda_align_add_size(next_offset, sizeof(int), num->digits - num->buf + num->ndigits,
&offset,&next_offset); 
+                    memcpy((char *) sqlda + offset, num->buf, num->digits - num->buf + num->ndigits);

-                        ((numeric *) sqlda->sqlvar[i].sqldata)->buf = (NumericDigit *) sqlda + offset;
-                        ((numeric *) sqlda->sqlvar[i].sqldata)->digits = (NumericDigit *) sqlda + offset +
(num->digits- num->buf); 
-                    }
+                    ((numeric *) sqlda->sqlvar[i].sqldata)->buf = (NumericDigit *) sqlda + offset;
+                    ((numeric *) sqlda->sqlvar[i].sqldata)->digits = (NumericDigit *) sqlda + offset + (num->digits -
num->buf);

                     PGTYPESnumeric_free(num);

@@ -534,14 +533,11 @@ ecpg_set_native_sqlda(int lineno, struct sqlda_struct **_sqlda, const PGresult *

                     memcpy(sqlda->sqlvar[i].sqldata, num, sizeof(numeric));

-                    if (num->ndigits)
-                    {
-                        ecpg_sqlda_align_add_size(next_offset, sizeof(int), num->ndigits + 1, &offset, &next_offset);
-                        memcpy((char *) sqlda + offset, num->buf, num->ndigits + 1);
+                    ecpg_sqlda_align_add_size(next_offset, sizeof(int), num->digits - num->buf + num->ndigits,
&offset,&next_offset); 
+                    memcpy((char *) sqlda + offset, num->buf, num->digits - num->buf + num->ndigits);

-                        ((numeric *) sqlda->sqlvar[i].sqldata)->buf = (NumericDigit *) sqlda + offset;
-                        ((numeric *) sqlda->sqlvar[i].sqldata)->digits = (NumericDigit *) sqlda + offset +
(num->digits- num->buf); 
-                    }
+                    ((numeric *) sqlda->sqlvar[i].sqldata)->buf = (NumericDigit *) sqlda + offset;
+                    ((numeric *) sqlda->sqlvar[i].sqldata)->digits = (NumericDigit *) sqlda + offset + (num->digits -
num->buf);

                     PGTYPESnumeric_free(num);

diff --git a/src/interfaces/ecpg/test/expected/sql-sqlda.c b/src/interfaces/ecpg/test/expected/sql-sqlda.c
index 398dced..dcd9f24 100644
--- a/src/interfaces/ecpg/test/expected/sql-sqlda.c
+++ b/src/interfaces/ecpg/test/expected/sql-sqlda.c
@@ -228,19 +228,19 @@ if (sqlca.sqlcode < 0) exit (1);}


     strcpy(msg, "insert");
-    { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' ,
1111111111111111111) , ( 2 , null , null , null , null , null ) , ( 4 , 'd' , 4.0 , 4 , 'd' , 4444444444444444444 )",
ECPGt_EOIT,ECPGt_EORT); 
-#line 97 "sqlda.pgc"
+    { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' ,
1111111111111111111) , ( 2 , null , null , null , null , null ) , ( 4 , 'd' , 4.0 , 4 , 'd' , 4444444444444444444 ) , (
5, 'e' , 0.001234 , 5 , 'e' , 5555555555555555555 )", ECPGt_EOIT, ECPGt_EORT); 
+#line 98 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 97 "sqlda.pgc"
+#line 98 "sqlda.pgc"


     strcpy(msg, "commit");
     { ECPGtrans(__LINE__, NULL, "commit");
-#line 100 "sqlda.pgc"
+#line 101 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 100 "sqlda.pgc"
+#line 101 "sqlda.pgc"


     /* SQLDA test for getting all records from a table */
@@ -249,29 +249,29 @@ if (sqlca.sqlcode < 0) exit (1);}

     strcpy(msg, "prepare");
     { ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1);
-#line 107 "sqlda.pgc"
+#line 108 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 107 "sqlda.pgc"
+#line 108 "sqlda.pgc"


     strcpy(msg, "declare");
     /* declare mycur1 cursor for $1 */
-#line 110 "sqlda.pgc"
+#line 111 "sqlda.pgc"


     strcpy(msg, "open");
     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare mycur1 cursor for $1",
     ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 113 "sqlda.pgc"
+#line 114 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 113 "sqlda.pgc"
+#line 114 "sqlda.pgc"


     /* exec sql whenever not found  break ; */
-#line 115 "sqlda.pgc"
+#line 116 "sqlda.pgc"


     rec = 0;
@@ -281,13 +281,13 @@ if (sqlca.sqlcode < 0) exit (1);}
         { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 from mycur1", ECPGt_EOIT,
     ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 121 "sqlda.pgc"
+#line 122 "sqlda.pgc"

 if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
-#line 121 "sqlda.pgc"
+#line 122 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 121 "sqlda.pgc"
+#line 122 "sqlda.pgc"


         printf("FETCH RECORD %d\n", ++rec);
@@ -295,23 +295,23 @@ if (sqlca.sqlcode < 0) exit (1);}
     }

     /* exec sql whenever not found  continue ; */
-#line 127 "sqlda.pgc"
+#line 128 "sqlda.pgc"


     strcpy(msg, "close");
     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close mycur1", ECPGt_EOIT, ECPGt_EORT);
-#line 130 "sqlda.pgc"
+#line 131 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 130 "sqlda.pgc"
+#line 131 "sqlda.pgc"


     strcpy(msg, "deallocate");
     { ECPGdeallocate(__LINE__, 0, NULL, "st_id1");
-#line 133 "sqlda.pgc"
+#line 134 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 133 "sqlda.pgc"
+#line 134 "sqlda.pgc"


     free(outp_sqlda);
@@ -322,35 +322,35 @@ if (sqlca.sqlcode < 0) exit (1);}

     strcpy(msg, "prepare");
     { ECPGprepare(__LINE__, NULL, 0, "st_id2", stmt1);
-#line 142 "sqlda.pgc"
+#line 143 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 142 "sqlda.pgc"
+#line 143 "sqlda.pgc"


     strcpy(msg, "declare");
     /* declare mycur2 cursor for $1 */
-#line 145 "sqlda.pgc"
+#line 146 "sqlda.pgc"


     strcpy(msg, "open");
     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare mycur2 cursor for $1",
     ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id2", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 148 "sqlda.pgc"
+#line 149 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 148 "sqlda.pgc"
+#line 149 "sqlda.pgc"


     strcpy(msg, "fetch");
     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch all from mycur2", ECPGt_EOIT,
     ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 151 "sqlda.pgc"
+#line 152 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 151 "sqlda.pgc"
+#line 152 "sqlda.pgc"


     outp_sqlda1 = outp_sqlda;
@@ -368,18 +368,18 @@ if (sqlca.sqlcode < 0) exit (1);}

     strcpy(msg, "close");
     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close mycur2", ECPGt_EOIT, ECPGt_EORT);
-#line 167 "sqlda.pgc"
+#line 168 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 167 "sqlda.pgc"
+#line 168 "sqlda.pgc"


     strcpy(msg, "deallocate");
     { ECPGdeallocate(__LINE__, 0, NULL, "st_id2");
-#line 170 "sqlda.pgc"
+#line 171 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 170 "sqlda.pgc"
+#line 171 "sqlda.pgc"


     /* SQLDA test for getting one record using an input descriptor */
@@ -403,10 +403,10 @@ if (sqlca.sqlcode < 0) exit (1);}

     strcpy(msg, "prepare");
     { ECPGprepare(__LINE__, NULL, 0, "st_id3", stmt2);
-#line 192 "sqlda.pgc"
+#line 193 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 192 "sqlda.pgc"
+#line 193 "sqlda.pgc"


     strcpy(msg, "execute");
@@ -415,20 +415,20 @@ if (sqlca.sqlcode < 0) exit (1);}
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
     ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 195 "sqlda.pgc"
+#line 196 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 195 "sqlda.pgc"
+#line 196 "sqlda.pgc"


     dump_sqlda(outp_sqlda);

     strcpy(msg, "deallocate");
     { ECPGdeallocate(__LINE__, 0, NULL, "st_id3");
-#line 200 "sqlda.pgc"
+#line 201 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 200 "sqlda.pgc"
+#line 201 "sqlda.pgc"


     free(inp_sqlda);
@@ -439,10 +439,10 @@ if (sqlca.sqlcode < 0) exit (1);}
      */

     { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , "con2", 0);
-#line 209 "sqlda.pgc"
+#line 210 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 209 "sqlda.pgc"
+#line 210 "sqlda.pgc"


     /*
@@ -464,10 +464,10 @@ if (sqlca.sqlcode < 0) exit (1);}

     strcpy(msg, "prepare");
     { ECPGprepare(__LINE__, "con2", 0, "st_id4", stmt2);
-#line 229 "sqlda.pgc"
+#line 230 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 229 "sqlda.pgc"
+#line 230 "sqlda.pgc"


     strcpy(msg, "execute");
@@ -476,28 +476,28 @@ if (sqlca.sqlcode < 0) exit (1);}
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
     ECPGt_sqlda, &outp_sqlda, 0L, 0L, 0L,
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 232 "sqlda.pgc"
+#line 233 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 232 "sqlda.pgc"
+#line 233 "sqlda.pgc"


     dump_sqlda(outp_sqlda);

     strcpy(msg, "commit");
     { ECPGtrans(__LINE__, "con2", "commit");
-#line 237 "sqlda.pgc"
+#line 238 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 237 "sqlda.pgc"
+#line 238 "sqlda.pgc"


     strcpy(msg, "deallocate");
     { ECPGdeallocate(__LINE__, 0, NULL, "st_id4");
-#line 240 "sqlda.pgc"
+#line 241 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 240 "sqlda.pgc"
+#line 241 "sqlda.pgc"


     free(inp_sqlda);
@@ -505,36 +505,36 @@ if (sqlca.sqlcode < 0) exit (1);}

     strcpy(msg, "disconnect");
     { ECPGdisconnect(__LINE__, "con2");
-#line 246 "sqlda.pgc"
+#line 247 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 246 "sqlda.pgc"
+#line 247 "sqlda.pgc"


     /* End test */

     strcpy(msg, "drop");
     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT);
-#line 251 "sqlda.pgc"
+#line 252 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 251 "sqlda.pgc"
+#line 252 "sqlda.pgc"


     strcpy(msg, "commit");
     { ECPGtrans(__LINE__, NULL, "commit");
-#line 254 "sqlda.pgc"
+#line 255 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 254 "sqlda.pgc"
+#line 255 "sqlda.pgc"


     strcpy(msg, "disconnect");
     { ECPGdisconnect(__LINE__, "CURRENT");
-#line 257 "sqlda.pgc"
+#line 258 "sqlda.pgc"

 if (sqlca.sqlcode < 0) exit (1);}
-#line 257 "sqlda.pgc"
+#line 258 "sqlda.pgc"


     return 0;
diff --git a/src/interfaces/ecpg/test/expected/sql-sqlda.stderr b/src/interfaces/ecpg/test/expected/sql-sqlda.stderr
index 8c70100..26a772e 100644
--- a/src/interfaces/ecpg/test/expected/sql-sqlda.stderr
+++ b/src/interfaces/ecpg/test/expected/sql-sqlda.stderr
@@ -14,323 +14,385 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_process_output on line 84: OK: CREATE TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 94: query: insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' , 1111111111111111111 ) , (
2, null , null , null , null , null ) , ( 4 , 'd' , 4.0 , 4 , 'd' , 4444444444444444444 ); with 0 parameter(s) on
connectionregress1 
+[NO_PID]: ecpg_execute on line 94: query: insert into t1 values ( 1 , 'a' , 1.0 , 1 , 'a' , 1111111111111111111 ) , (
2, null , null , null , null , null ) , ( 4 , 'd' , 4.0 , 4 , 'd' , 4444444444444444444 ) , ( 5 , 'e' , 0.001234 , 5 ,
'e', 5555555555555555555 ); with 0 parameter(s) on connection regress1 
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_execute on line 94: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 94: OK: INSERT 0 3
+[NO_PID]: ecpg_process_output on line 94: OK: INSERT 0 4
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans on line 100: action "commit"; connection "regress1"
+[NO_PID]: ECPGtrans on line 101: action "commit"; connection "regress1"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: prepare_common on line 107: name st_id1; query: "SELECT * FROM t1"
+[NO_PID]: prepare_common on line 108: name st_id1; query: "SELECT * FROM t1"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 113: query: declare mycur1 cursor for SELECT * FROM t1; with 0 parameter(s) on
connectionregress1 
+[NO_PID]: ecpg_execute on line 114: query: declare mycur1 cursor for SELECT * FROM t1; with 0 parameter(s) on
connectionregress1 
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 113: using PQexec
+[NO_PID]: ecpg_execute on line 114: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 113: OK: DECLARE CURSOR
+[NO_PID]: ecpg_process_output on line 114: OK: DECLARE CURSOR
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 121: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 122: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 121: using PQexec
+[NO_PID]: ecpg_execute on line 122: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 121: correctly got 1 tuples with 6 fields
+[NO_PID]: ecpg_process_output on line 122: correctly got 1 tuples with 6 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_build_native_sqlda on line 121 sqld = 6
+[NO_PID]: ecpg_build_native_sqlda on line 122 sqld = 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 121: new sqlda was built
+[NO_PID]: ecpg_process_output on line 122: new sqlda was built
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 0 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 0 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 121: RESULT: 1 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 122: RESULT: 1 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 1 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 1 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 121: RESULT: a offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 122: RESULT: a offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 2 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 2 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 3 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 3 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 121: RESULT: 1 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 122: RESULT: 1 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 4 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 4 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 121: RESULT: a          offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 122: RESULT: a          offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 5 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 5 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 121: RESULT: 1111111111111111111 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 122: RESULT: 1111111111111111111 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 121: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: ecpg_process_output on line 122: putting result (1 tuple 6 fields) into sqlda descriptor
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 121: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 122: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 121: using PQexec
+[NO_PID]: ecpg_execute on line 122: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 121: correctly got 1 tuples with 6 fields
+[NO_PID]: ecpg_process_output on line 122: correctly got 1 tuples with 6 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_build_native_sqlda on line 121 sqld = 6
+[NO_PID]: ecpg_build_native_sqlda on line 122 sqld = 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 121: new sqlda was built
+[NO_PID]: ecpg_process_output on line 122: new sqlda was built
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 0 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 0 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 121: RESULT: 2 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 122: RESULT: 2 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 1 IS NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 1 IS NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 2 IS NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 2 IS NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 3 IS NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 3 IS NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 4 IS NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 4 IS NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 5 IS NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 5 IS NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 121: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: ecpg_process_output on line 122: putting result (1 tuple 6 fields) into sqlda descriptor
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 121: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 122: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 121: using PQexec
+[NO_PID]: ecpg_execute on line 122: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 121: correctly got 1 tuples with 6 fields
+[NO_PID]: ecpg_process_output on line 122: correctly got 1 tuples with 6 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_build_native_sqlda on line 121 sqld = 6
+[NO_PID]: ecpg_build_native_sqlda on line 122 sqld = 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 121: new sqlda was built
+[NO_PID]: ecpg_process_output on line 122: new sqlda was built
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 0 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 0 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 121: RESULT: 4 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 122: RESULT: 4 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 1 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 1 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 121: RESULT: d offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 122: RESULT: d offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 2 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 2 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 3 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 3 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 121: RESULT: 4 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 122: RESULT: 4 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 4 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 4 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 121: RESULT: d          offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 122: RESULT: d          offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 121 row 0 col 5 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 5 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 121: RESULT: 4444444444444444444 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 122: RESULT: 4444444444444444444 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 121: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: ecpg_process_output on line 122: putting result (1 tuple 6 fields) into sqlda descriptor
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 121: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 122: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 121: using PQexec
+[NO_PID]: ecpg_execute on line 122: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 121: correctly got 0 tuples with 6 fields
+[NO_PID]: ecpg_process_output on line 122: correctly got 1 tuples with 6 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 on line 121: no data found on line 121
+[NO_PID]: ecpg_build_native_sqlda on line 122 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 122: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 122: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 1 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 122: RESULT: e offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 2 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 3 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 122: RESULT: 5 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 4 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 122: RESULT: e          offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 122 row 0 col 5 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 122: RESULT: 5555555555555555555 offset: -1; array: no
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 122: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 122: query: fetch 1 from mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 122: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 122: correctly got 0 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: raising sqlcode 100 on line 122: no data found on line 122
 [NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ecpg_execute on line 130: query: close mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 131: query: close mycur1; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 131: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 131: OK: CLOSE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: deallocate_one on line 134: name st_id1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: prepare_common on line 143: name st_id2; query: "SELECT * FROM t1"
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 149: query: declare mycur2 cursor for SELECT * FROM t1; with 0 parameter(s) on
connectionregress1 
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 149: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 149: OK: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 152: query: fetch all from mycur2; with 0 parameter(s) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_execute on line 152: using PQexec
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 152: correctly got 4 tuples with 6 fields
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_build_native_sqlda on line 152 sqld = 6
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_process_output on line 152: new sqlda was built
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 3 col 0 IS NOT NULL
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ecpg_get_data on line 152: RESULT: 5 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 130: using PQexec
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 3 col 1 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 130: OK: CLOSE CURSOR
+[NO_PID]: ecpg_get_data on line 152: RESULT: e offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: deallocate_one on line 133: name st_id1
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 3 col 2 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: prepare_common on line 142: name st_id2; query: "SELECT * FROM t1"
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 3 col 3 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 148: query: declare mycur2 cursor for SELECT * FROM t1; with 0 parameter(s) on
connectionregress1 
+[NO_PID]: ecpg_get_data on line 152: RESULT: 5 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 148: using PQexec
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 3 col 4 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 148: OK: DECLARE CURSOR
+[NO_PID]: ecpg_get_data on line 152: RESULT: e          offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 151: query: fetch all from mycur2; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 3 col 5 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 151: using PQexec
+[NO_PID]: ecpg_get_data on line 152: RESULT: 5555555555555555555 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 151: correctly got 3 tuples with 6 fields
+[NO_PID]: ecpg_process_output on line 152: putting result (1 tuple 6 fields) into sqlda descriptor
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_build_native_sqlda on line 151 sqld = 6
+[NO_PID]: ecpg_build_native_sqlda on line 152 sqld = 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 151: new sqlda was built
+[NO_PID]: ecpg_process_output on line 152: new sqlda was built
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 2 col 0 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 2 col 0 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 151: RESULT: 4 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 152: RESULT: 4 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 2 col 1 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 2 col 1 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 151: RESULT: d offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 152: RESULT: d offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 2 col 2 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 2 col 2 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 2 col 3 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 2 col 3 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 151: RESULT: 4 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 152: RESULT: 4 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 2 col 4 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 2 col 4 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 151: RESULT: d          offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 152: RESULT: d          offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 2 col 5 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 2 col 5 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 151: RESULT: 4444444444444444444 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 152: RESULT: 4444444444444444444 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 151: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: ecpg_process_output on line 152: putting result (1 tuple 6 fields) into sqlda descriptor
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_build_native_sqlda on line 151 sqld = 6
+[NO_PID]: ecpg_build_native_sqlda on line 152 sqld = 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 151: new sqlda was built
+[NO_PID]: ecpg_process_output on line 152: new sqlda was built
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 1 col 0 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 1 col 0 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 151: RESULT: 2 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 152: RESULT: 2 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 1 col 1 IS NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 1 col 1 IS NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 1 col 2 IS NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 1 col 2 IS NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 1 col 3 IS NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 1 col 3 IS NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 1 col 4 IS NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 1 col 4 IS NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 1 col 5 IS NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 1 col 5 IS NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 151: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: ecpg_process_output on line 152: putting result (1 tuple 6 fields) into sqlda descriptor
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_build_native_sqlda on line 151 sqld = 6
+[NO_PID]: ecpg_build_native_sqlda on line 152 sqld = 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 151: new sqlda was built
+[NO_PID]: ecpg_process_output on line 152: new sqlda was built
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 0 col 0 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 0 col 0 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 151: RESULT: 1 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 152: RESULT: 1 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 0 col 1 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 0 col 1 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 151: RESULT: a offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 152: RESULT: a offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 0 col 2 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 0 col 2 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 0 col 3 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 0 col 3 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 151: RESULT: 1 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 152: RESULT: 1 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 0 col 4 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 0 col 4 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 151: RESULT: a          offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 152: RESULT: a          offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 151 row 0 col 5 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 152 row 0 col 5 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 151: RESULT: 1111111111111111111 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 152: RESULT: 1111111111111111111 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 151: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: ecpg_process_output on line 152: putting result (1 tuple 6 fields) into sqlda descriptor
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 167: query: close mycur2; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 168: query: close mycur2; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 167: using PQexec
+[NO_PID]: ecpg_execute on line 168: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 167: OK: CLOSE CURSOR
+[NO_PID]: ecpg_process_output on line 168: OK: CLOSE CURSOR
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: deallocate_one on line 170: name st_id2
+[NO_PID]: deallocate_one on line 171: name st_id2
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: prepare_common on line 192: name st_id3; query: "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: prepare_common on line 193: name st_id3; query: "SELECT * FROM t1 WHERE id = $1"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 195: query: SELECT * FROM t1 WHERE id = $1; with 1 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 196: query: SELECT * FROM t1 WHERE id = $1; with 1 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 195: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: ecpg_execute on line 196: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 195: parameter 1 = 4
+[NO_PID]: ecpg_free_params on line 196: parameter 1 = 4
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 195: correctly got 1 tuples with 6 fields
+[NO_PID]: ecpg_process_output on line 196: correctly got 1 tuples with 6 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_build_native_sqlda on line 195 sqld = 6
+[NO_PID]: ecpg_build_native_sqlda on line 196 sqld = 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 195: new sqlda was built
+[NO_PID]: ecpg_process_output on line 196: new sqlda was built
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 195 row 0 col 0 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 196 row 0 col 0 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 195: RESULT: 4 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 196: RESULT: 4 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 195 row 0 col 1 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 196 row 0 col 1 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 195: RESULT: d offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 196: RESULT: d offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 195 row 0 col 2 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 196 row 0 col 2 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 195 row 0 col 3 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 196 row 0 col 3 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 195: RESULT: 4 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 196: RESULT: 4 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 195 row 0 col 4 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 196 row 0 col 4 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 195: RESULT: d          offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 196: RESULT: d          offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 195 row 0 col 5 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 196 row 0 col 5 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 195: RESULT: 4444444444444444444 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 196: RESULT: 4444444444444444444 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 195: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: ecpg_process_output on line 196: putting result (1 tuple 6 fields) into sqlda descriptor
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: deallocate_one on line 200: name st_id3
+[NO_PID]: deallocate_one on line 201: name st_id3
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT>
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: prepare_common on line 229: name st_id4; query: "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: prepare_common on line 230: name st_id4; query: "SELECT * FROM t1 WHERE id = $1"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 232: query: SELECT * FROM t1 WHERE id = $1; with 1 parameter(s) on connection con2
+[NO_PID]: ecpg_execute on line 233: query: SELECT * FROM t1 WHERE id = $1; with 1 parameter(s) on connection con2
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 232: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
+[NO_PID]: ecpg_execute on line 233: using PQexecPrepared for "SELECT * FROM t1 WHERE id = $1"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 232: parameter 1 = 4
+[NO_PID]: ecpg_free_params on line 233: parameter 1 = 4
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 232: correctly got 1 tuples with 6 fields
+[NO_PID]: ecpg_process_output on line 233: correctly got 1 tuples with 6 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_build_native_sqlda on line 232 sqld = 6
+[NO_PID]: ecpg_build_native_sqlda on line 233 sqld = 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 232: new sqlda was built
+[NO_PID]: ecpg_process_output on line 233: new sqlda was built
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 232 row 0 col 0 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 233 row 0 col 0 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 232: RESULT: 4 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 233: RESULT: 4 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 232 row 0 col 1 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 233 row 0 col 1 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 232: RESULT: d offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 233: RESULT: d offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 232 row 0 col 2 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 233 row 0 col 2 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 232 row 0 col 3 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 233 row 0 col 3 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 232: RESULT: 4 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 233: RESULT: 4 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 232 row 0 col 4 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 233 row 0 col 4 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 232: RESULT: d          offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 233: RESULT: d          offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_set_native_sqlda on line 232 row 0 col 5 IS NOT NULL
+[NO_PID]: ecpg_set_native_sqlda on line 233 row 0 col 5 IS NOT NULL
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 232: RESULT: 4444444444444444444 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 233: RESULT: 4444444444444444444 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 232: putting result (1 tuple 6 fields) into sqlda descriptor
+[NO_PID]: ecpg_process_output on line 233: putting result (1 tuple 6 fields) into sqlda descriptor
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans on line 237: action "commit"; connection "con2"
+[NO_PID]: ECPGtrans on line 238: action "commit"; connection "con2"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: deallocate_one on line 240: name st_id4
+[NO_PID]: deallocate_one on line 241: name st_id4
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_finish: connection con2 closed
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 251: query: drop table t1; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 252: query: drop table t1; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 251: using PQexec
+[NO_PID]: ecpg_execute on line 252: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 251: OK: DROP TABLE
+[NO_PID]: ecpg_process_output on line 252: OK: DROP TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans on line 254: action "commit"; connection "regress1"
+[NO_PID]: ECPGtrans on line 255: action "commit"; connection "regress1"
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_finish: connection regress1 closed
 [NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/sql-sqlda.stdout b/src/interfaces/ecpg/test/expected/sql-sqlda.stdout
index 26390df..423fb8c 100644
--- a/src/interfaces/ecpg/test/expected/sql-sqlda.stdout
+++ b/src/interfaces/ecpg/test/expected/sql-sqlda.stdout
@@ -19,6 +19,13 @@ name sqlda descriptor: 'd1' value NUMERIC '4.0'
 name sqlda descriptor: 'd2' value 4.000000
 name sqlda descriptor: 'c' value 'd         '
 name sqlda descriptor: 'big' value 4444444444444444444
+FETCH RECORD 4
+name sqlda descriptor: 'id' value 5
+name sqlda descriptor: 't' value 'e'
+name sqlda descriptor: 'd1' value NUMERIC '0.001234'
+name sqlda descriptor: 'd2' value 5.000000
+name sqlda descriptor: 'c' value 'e         '
+name sqlda descriptor: 'big' value 5555555555555555555
 FETCH RECORD 1
 name sqlda descriptor: 'id' value 1
 name sqlda descriptor: 't' value 'a'
@@ -40,6 +47,13 @@ name sqlda descriptor: 'd1' value NUMERIC '4.0'
 name sqlda descriptor: 'd2' value 4.000000
 name sqlda descriptor: 'c' value 'd         '
 name sqlda descriptor: 'big' value 4444444444444444444
+FETCH RECORD 4
+name sqlda descriptor: 'id' value 5
+name sqlda descriptor: 't' value 'e'
+name sqlda descriptor: 'd1' value NUMERIC '0.001234'
+name sqlda descriptor: 'd2' value 5.000000
+name sqlda descriptor: 'c' value 'e         '
+name sqlda descriptor: 'big' value 5555555555555555555
 EXECUTE RECORD 4
 name sqlda descriptor: 'id' value 4
 name sqlda descriptor: 't' value 'd'
diff --git a/src/interfaces/ecpg/test/sql/sqlda.pgc b/src/interfaces/ecpg/test/sql/sqlda.pgc
index ec4d256..5bb0d9e 100644
--- a/src/interfaces/ecpg/test/sql/sqlda.pgc
+++ b/src/interfaces/ecpg/test/sql/sqlda.pgc
@@ -94,7 +94,8 @@ exec sql end declare section;
     exec sql insert into t1 values
         (1, 'a', 1.0, 1, 'a',1111111111111111111),
         (2, null, null, null, null,null),
-        (4, 'd', 4.0, 4, 'd',4444444444444444444);
+        (4, 'd', 4.0, 4, 'd',4444444444444444444),
+        (5, 'e', 0.001234, 5, 'e',5555555555555555555);

     strcpy(msg, "commit");
     exec sql commit;

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jürgen Strobel
Дата:
Сообщение: Re: BUG #15212: Default values in partition tables don't work asexpected and allow NOT NULL violation
Следующее
От: David Rowley
Дата:
Сообщение: Re: Speeding up INSERTs and UPDATEs to partitioned tables