Re: define bool in pgtypeslib_extern.h - Mailing list pgsql-hackers

From Tom Lane
Subject Re: define bool in pgtypeslib_extern.h
Date
Msg-id 20590.1573069709@sss.pgh.pa.us
Whole thread Raw
In response to Re: define bool in pgtypeslib_extern.h  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> I'm wondering whether we should actually go the opposite way and say
> that c.h's "bool" definition should be backend only, and that in
> frontend code we should define a PG_bool type or something of that ilk
> for when we want "PG's 1-byte bool" and otherwise let the platform
> define "bool" however it wants.
> And we certainly shouldn't be defining "bool" in something that's going
> to be included in the user's code the way that ecpglib.h is.

I experimented with doing things that way, and ended up with the attached
draft patch.  It basically gets ecpglib.h out of the business of declaring
any bool-related stuff at all, instead insisting that client code include
<stdbool.h> or otherwise declare bool for itself.  The function
declarations that were previously relying on "bool" now use the "pqbool"
typedef that libpq-fe.h was already exporting.  Per discussion, that's
not an ABI break, even on platforms where sizeof(_Bool) > 1, because
the actual underlying library functions are certainly expecting to take
or return a value of size 1.

While this seems like a generally cleaner place to be, I'm a bit concerned
about a number of aspects:

* This will of course be an API break for clients, which might not've
included <stdbool.h> before.

* On platforms where sizeof(_Bool) > 1, it's far from clear to me that
ECPG will interface correctly with client code that is treating bool
as _Bool.  There are some places that seem to be prepared for bool
client variables to be either sizeof(char) or sizeof(int), for example
ecpg_store_input(), but there are a fair number of other places that
seem to assume that sizeof(bool) is relevant, which it won't be.
The ECPG regression tests do pass for me on a PPC Mac, but I wonder
how much that proves.

* The "sql/dyntest.pgc" test declares BOOLVAR as "char" and then does

  exec sql var BOOLVAR is bool;

It's not clear to me what the implications of that statement are
(and our manual is no help), but looking at the generated code,
it seems like this causes ecpg to believe that the size of the
variable is sizeof(bool).  So that looks like buffer overrun
trouble waiting to happen.  I changed the variable declaration to
"bool" in the attached, but I wonder what's supposed to be getting
tested there.

On the whole I'm not finding this an attractive way to proceed
compared to the other approach I sketched.  It will certainly
cause some clients to have compile failures, and I'm at best
queasy about whether it will really work on platforms where
sizeof(_Bool) > 1.  I think we're better off to go with the
other approach of making ecpglib.h export what we think the
correct definition of bool is.  For most people that will
end up being <stdbool.h>, which I think will be unsurprising.

            regards, tom lane

PS: another issue this fixes, which I think we ought to fix and back-patch
regardless of what we decide about bool, is it moves the declaration for
ecpg_gettext() out of ecpglib.h and into the private header
ecpglib_extern.h.  That function isn't meant for client access, the
declaration is wrong where it is because it is not inside extern "C",
and the declaration wouldn't even compile for clients because they
will not know what pg_attribute_format_arg() is.  The only reason we've
not had complaints, I imagine, is that nobody's tried to compile client
code with ENABLE_NLS defined ... but that's already an intrusion on
client namespace.

diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml
index 8fe2a90..7e3f9ff 100644
--- a/doc/src/sgml/ecpg.sgml
+++ b/doc/src/sgml/ecpg.sgml
@@ -944,7 +944,7 @@ do

       <row>
        <entry><type>boolean</type></entry>
-       <entry><type>bool</type><footnote><para>declared in <filename>ecpglib.h</filename> if not
native</para></footnote></entry>
+       <entry><type>bool</type><footnote><para>should be declared by including
<filename><stdbool.h></filename></para></footnote></entry>
       </row>

       <row>
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c
index 1cb5211..f816f8b 100644
--- a/src/interfaces/ecpg/ecpglib/connect.c
+++ b/src/interfaces/ecpg/ecpglib/connect.c
@@ -161,7 +161,7 @@ ecpg_finish(struct connection *act)
         ecpg_log("ecpg_finish: called an extra time\n");
 }

-bool
+pqbool
 ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
 {
     struct connection *con = ecpg_get_connection(connection_name);
@@ -198,7 +198,7 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
     return true;
 }

-bool
+pqbool
 ECPGsetconn(int lineno, const char *connection_name)
 {
     struct connection *con = ecpg_get_connection(connection_name);
@@ -267,7 +267,7 @@ ECPGnoticeReceiver(void *arg, const PGresult *result)
 }

 /* this contains some quick hacks, needs to be cleaned up, but it works */
-bool
+pqbool
 ECPGconnect(int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name,
intautocommit) 
 {
     struct sqlca_t *sqlca = ECPGget_sqlca();
@@ -680,7 +680,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
     return true;
 }

-bool
+pqbool
 ECPGdisconnect(int lineno, const char *connection_name)
 {
     struct sqlca_t *sqlca = ECPGget_sqlca();
diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c
index ead8778..5ba444b 100644
--- a/src/interfaces/ecpg/ecpglib/descriptor.c
+++ b/src/interfaces/ecpg/ecpglib/descriptor.c
@@ -87,7 +87,7 @@ ecpg_dynamic_type_DDT(Oid type)
     }
 }

-bool
+pqbool
 ECPGget_desc_header(int lineno, const char *desc_name, int *count)
 {
     PGresult   *ECPGresult;
@@ -241,7 +241,7 @@ get_char_item(int lineno, void *var, enum ECPGttype vartype, char *value, int va
                     return false; \
                 }

-bool
+pqbool
 ECPGget_desc(int lineno, const char *desc_name, int index,...)
 {
     va_list        args;
@@ -575,7 +575,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)

 #undef RETURN_IF_NO_DATA

-bool
+pqbool
 ECPGset_desc_header(int lineno, const char *desc_name, int count)
 {
     struct descriptor *desc = ecpg_find_desc(lineno, desc_name);
@@ -607,7 +607,7 @@ set_desc_attr(struct descriptor_item *desc_item, struct variable *var,
 }


-bool
+pqbool
 ECPGset_desc(int lineno, const char *desc_name, int index,...)
 {
     va_list        args;
@@ -750,7 +750,7 @@ descriptor_free(struct descriptor *desc)
     ecpg_free(desc);
 }

-bool
+pqbool
 ECPGdeallocate_desc(int line, const char *name)
 {
     struct descriptor *desc;
@@ -797,7 +797,7 @@ descriptor_deallocate_all(struct descriptor *list)
 }
 #endif                            /* ENABLE_THREAD_SAFETY */

-bool
+pqbool
 ECPGallocate_desc(int line, const char *name)
 {
     struct descriptor *new;
@@ -852,10 +852,10 @@ ecpg_find_desc(int line, const char *name)
     return NULL;                /* not found */
 }

-bool
-ECPGdescribe(int line, int compat, bool input, const char *connection_name, const char *stmt_name,...)
+pqbool
+ECPGdescribe(int line, int compat, pqbool input, const char *connection_name, const char *stmt_name,...)
 {
-    bool        ret = false;
+    pqbool        ret = false;
     struct connection *con;
     struct prepared_statement *prep;
     PGresult   *res;
diff --git a/src/interfaces/ecpg/ecpglib/ecpglib_extern.h b/src/interfaces/ecpg/ecpglib/ecpglib_extern.h
index f788bfd..4bf55fe 100644
--- a/src/interfaces/ecpg/ecpglib/ecpglib_extern.h
+++ b/src/interfaces/ecpg/ecpglib/ecpglib_extern.h
@@ -219,6 +219,12 @@ unsigned    ecpg_hex_dec_len(unsigned srclen);
 unsigned    ecpg_hex_enc_len(unsigned srclen);
 unsigned    ecpg_hex_encode(const char *src, unsigned len, char *dst);

+#ifdef ENABLE_NLS
+extern char *ecpg_gettext(const char *msgid) pg_attribute_format_arg(1);
+#else
+#define ecpg_gettext(x) (x)
+#endif
+
 /* SQLSTATE values generated or processed by ecpglib (intentionally
  * not exported -- users should refer to the codes directly) */

diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 23cc869..c8dbdff 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -2274,11 +2274,11 @@ fail:
  * Execute SQL statements in the backend.
  * The input/output parameters are passed as variable-length argument list.
  */
-bool
-ECPGdo(const int lineno, const int compat, const int force_indicator, const char *connection_name, const bool
questionmarks,const int st, const char *query,...) 
+pqbool
+ECPGdo(const int lineno, const int compat, const int force_indicator, const char *connection_name, const pqbool
questionmarks,const int st, const char *query,...) 
 {
     va_list        args;
-    bool        ret;
+    pqbool        ret;

     va_start(args, query);
     ret = ecpg_do(lineno, compat, force_indicator, connection_name,
@@ -2289,7 +2289,7 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
 }

 /* old descriptor interface */
-bool
+pqbool
 ECPGdo_descriptor(int line, const char *connection,
                   const char *descriptor, const char *query)
 {
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index 647da14..7311c8c 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -162,7 +162,7 @@ ECPGget_sqlca(void)
 #endif
 }

-bool
+pqbool
 ECPGstatus(int lineno, const char *connection_name)
 {
     struct connection *con = ecpg_get_connection(connection_name);
@@ -196,7 +196,7 @@ ECPGtransactionStatus(const char *connection_name)

 }

-bool
+pqbool
 ECPGtrans(int lineno, const char *connection_name, const char *transaction)
 {
     PGresult   *res;
@@ -388,7 +388,7 @@ _check(const unsigned char *ptr, int length)
     return true;
 }

-bool
+pqbool
 ECPGis_noind_null(enum ECPGttype type, const void *ptr)
 {
     switch (type)
diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c
index b9653c0..397e78a 100644
--- a/src/interfaces/ecpg/ecpglib/prepare.c
+++ b/src/interfaces/ecpg/ecpglib/prepare.c
@@ -213,8 +213,8 @@ prepare_common(int lineno, struct connection *con, const char *name, const char

 /* handle the EXEC SQL PREPARE statement */
 /* questionmarks is not needed but remains in there for the time being to not change the API */
-bool
-ECPGprepare(int lineno, const char *connection_name, const bool questionmarks,
+pqbool
+ECPGprepare(int lineno, const char *connection_name, const pqbool questionmarks,
             const char *name, const char *variable)
 {
     struct connection *con;
@@ -311,7 +311,7 @@ deallocate_one(int lineno, enum COMPAT_MODE c, struct connection *con,
 }

 /* handle the EXEC SQL DEALLOCATE PREPARE statement */
-bool
+pqbool
 ECPGdeallocate(int lineno, int c, const char *connection_name, const char *name)
 {
     struct connection *con;
@@ -346,7 +346,7 @@ ecpg_deallocate_all_conn(int lineno, enum COMPAT_MODE c, struct connection *con)
     return true;
 }

-bool
+pqbool
 ECPGdeallocate_all(int lineno, int compat, const char *connection_name)
 {
     return ecpg_deallocate_all_conn(lineno, compat,
diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h
index a9bc584..b278c3e 100644
--- a/src/interfaces/ecpg/include/ecpglib.h
+++ b/src/interfaces/ecpg/include/ecpglib.h
@@ -1,6 +1,6 @@
 /*
- * this is a small part of c.h since we don't want to leak all postgres
- * definitions into ecpg programs
+ * Client-visible declarations for ecpglib
+ *
  * src/interfaces/ecpg/include/ecpglib.h
  */

@@ -12,49 +12,22 @@
 #include "sqlca.h"
 #include <string.h>

-#ifdef ENABLE_NLS
-extern char *ecpg_gettext(const char *msgid) pg_attribute_format_arg(1);
-#else
-#define ecpg_gettext(x) (x)
-#endif
-
-#ifndef __cplusplus
-#ifndef bool
-#define bool char
-#endif                            /* ndef bool */
-
-#ifndef true
-#define true    ((bool) 1)
-#endif                            /* ndef true */
-#ifndef false
-#define false    ((bool) 0)
-#endif                            /* ndef false */
-#endif                            /* not C++ */
-
-#ifndef TRUE
-#define TRUE    1
-#endif                            /* TRUE */
-
-#ifndef FALSE
-#define FALSE    0
-#endif                            /* FALSE */
-
 #ifdef __cplusplus
 extern "C"
 {
 #endif

 void        ECPGdebug(int, FILE *);
-bool        ECPGstatus(int, const char *);
-bool        ECPGsetcommit(int, const char *, const char *);
-bool        ECPGsetconn(int, const char *);
-bool        ECPGconnect(int, int, const char *, const char *, const char *, const char *, int);
-bool        ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...);
-bool        ECPGtrans(int, const char *, const char *);
-bool        ECPGdisconnect(int, const char *);
-bool        ECPGprepare(int, const char *, const bool, const char *, const char *);
-bool        ECPGdeallocate(int, int, const char *, const char *);
-bool        ECPGdeallocate_all(int, int, const char *);
+pqbool        ECPGstatus(int, const char *);
+pqbool        ECPGsetcommit(int, const char *, const char *);
+pqbool        ECPGsetconn(int, const char *);
+pqbool        ECPGconnect(int, int, const char *, const char *, const char *, const char *, int);
+pqbool        ECPGdo(const int, const int, const int, const char *, const pqbool, const int, const char *,...);
+pqbool        ECPGtrans(int, const char *, const char *);
+pqbool        ECPGdisconnect(int, const char *);
+pqbool        ECPGprepare(int, const char *, const pqbool, const char *, const char *);
+pqbool        ECPGdeallocate(int, int, const char *, const char *);
+pqbool        ECPGdeallocate_all(int, int, const char *);
 char       *ECPGprepared_statement(const char *, const char *, int);
 PGconn       *ECPGget_PGconn(const char *);
 PGTransactionStatusType ECPGtransactionStatus(const char *);
@@ -69,17 +42,17 @@ void        sqlprint(void);

 /* dynamic SQL */

-bool        ECPGdo_descriptor(int, const char *, const char *, const char *);
-bool        ECPGdeallocate_desc(int, const char *);
-bool        ECPGallocate_desc(int, const char *);
-bool        ECPGget_desc_header(int, const char *, int *);
-bool        ECPGget_desc(int, const char *, int,...);
-bool        ECPGset_desc_header(int, const char *, int);
-bool        ECPGset_desc(int, const char *, int,...);
+pqbool        ECPGdo_descriptor(int, const char *, const char *, const char *);
+pqbool        ECPGdeallocate_desc(int, const char *);
+pqbool        ECPGallocate_desc(int, const char *);
+pqbool        ECPGget_desc_header(int, const char *, int *);
+pqbool        ECPGget_desc(int, const char *, int,...);
+pqbool        ECPGset_desc_header(int, const char *, int);
+pqbool        ECPGset_desc(int, const char *, int,...);

 void        ECPGset_noind_null(enum ECPGttype, void *);
-bool        ECPGis_noind_null(enum ECPGttype, const void *);
-bool        ECPGdescribe(int, int, bool, const char *, const char *,...);
+pqbool        ECPGis_noind_null(enum ECPGttype, const void *);
+pqbool        ECPGdescribe(int, int, pqbool, const char *, const char *,...);

 void        ECPGset_var(int, void *, int);
 void       *ECPGget_var(int number);
diff --git a/src/interfaces/ecpg/test/compat_informix/rnull.pgc b/src/interfaces/ecpg/test/compat_informix/rnull.pgc
index a6ad35e..5604a91 100644
--- a/src/interfaces/ecpg/test/compat_informix/rnull.pgc
+++ b/src/interfaces/ecpg/test/compat_informix/rnull.pgc
@@ -1,5 +1,6 @@
 #include "sqltypes.h"
 #include <stdlib.h>
+#include <stdbool.h>

 $include ../regression;
 $define NUMBER 12;
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rnull.c
b/src/interfaces/ecpg/test/expected/compat_informix-rnull.c
index d7ba69c..28d7ba1 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-rnull.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rnull.c
@@ -11,6 +11,7 @@
 #line 1 "rnull.pgc"
 #include "sqltypes.h"
 #include <stdlib.h>
+#include <stdbool.h>


 #line 1 "regression.h"
@@ -20,7 +21,7 @@



-#line 4 "rnull.pgc"
+#line 5 "rnull.pgc"



@@ -33,89 +34,89 @@ test_null(int type, char *ptr)
 int main(void)
 {

-#line 15 "rnull.pgc"
- char c [] = "abc" ;
-
-#line 15 "rnull.pgc"
-
-
 #line 16 "rnull.pgc"
- short s = 17 ;
+ char c [] = "abc" ;

 #line 16 "rnull.pgc"


 #line 17 "rnull.pgc"
- int i = - 74874 ;
+ short s = 17 ;

 #line 17 "rnull.pgc"


 #line 18 "rnull.pgc"
- bool b = 1 ;
+ int i = - 74874 ;

 #line 18 "rnull.pgc"


 #line 19 "rnull.pgc"
- float f = 3.71 ;
+ bool b = 1 ;

 #line 19 "rnull.pgc"


 #line 20 "rnull.pgc"
- long l = 487444 ;
+ float f = 3.71 ;

 #line 20 "rnull.pgc"


 #line 21 "rnull.pgc"
- double dbl = 404.404 ;
+ long l = 487444 ;

 #line 21 "rnull.pgc"


 #line 22 "rnull.pgc"
- decimal dec ;
+ double dbl = 404.404 ;

 #line 22 "rnull.pgc"


 #line 23 "rnull.pgc"
- date dat ;
+ decimal dec ;

 #line 23 "rnull.pgc"


 #line 24 "rnull.pgc"
- timestamp tmp ;
+ date dat ;

 #line 24 "rnull.pgc"

+
+#line 25 "rnull.pgc"
+ timestamp tmp ;
+
+#line 25 "rnull.pgc"
+

     ECPGdebug(1, stderr);
     /* exec sql whenever sqlerror  do sqlprint ( ) ; */
-#line 27 "rnull.pgc"
+#line 28 "rnull.pgc"


     { ECPGconnect(__LINE__, 1, "ecpg1_regression" , NULL, NULL , NULL, 0);
-#line 29 "rnull.pgc"
+#line 30 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 29 "rnull.pgc"
+#line 30 "rnull.pgc"


     { ECPGdo(__LINE__, 1, 0, NULL, 0, ECPGst_normal, "create table test ( id int , c char ( 10 ) , s smallint , i int
,b bool , f float , l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz )", ECPGt_EOIT,
ECPGt_EORT);
-#line 33 "rnull.pgc"
+#line 34 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 33 "rnull.pgc"
+#line 34 "rnull.pgc"

     { ECPGtrans(__LINE__, NULL, "commit");
-#line 34 "rnull.pgc"
+#line 35 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 34 "rnull.pgc"
+#line 35 "rnull.pgc"


     { ECPGdo(__LINE__, 1, 0, NULL, 0, ECPGst_normal, "insert into test ( id , c , s , i , b , f , l , dbl ) values ( 1
,$1  , $2  , $3  , $4  , $5  , $6  , $7  )",  
@@ -133,16 +134,16 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
     ECPGt_double,&(dbl),(long)1,(long)1,sizeof(double),
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 38 "rnull.pgc"
+#line 39 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 38 "rnull.pgc"
+#line 39 "rnull.pgc"

     { ECPGtrans(__LINE__, NULL, "commit");
-#line 39 "rnull.pgc"
+#line 40 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 39 "rnull.pgc"
+#line 40 "rnull.pgc"


     rsetnull(CCHARTYPE, (char *) c);
@@ -177,16 +178,16 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
     ECPGt_timestamp,&(tmp),(long)1,(long)1,sizeof(timestamp),
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 54 "rnull.pgc"
+#line 55 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 54 "rnull.pgc"
+#line 55 "rnull.pgc"

     { ECPGtrans(__LINE__, NULL, "commit");
-#line 55 "rnull.pgc"
+#line 56 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 55 "rnull.pgc"
+#line 56 "rnull.pgc"


     printf("first select\n");
@@ -212,10 +213,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
     ECPGt_timestamp,&(tmp),(long)1,(long)1,sizeof(timestamp),
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 61 "rnull.pgc"
+#line 62 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 61 "rnull.pgc"
+#line 62 "rnull.pgc"


     test_null(CCHARTYPE, (char *) c);
@@ -252,10 +253,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
     ECPGt_timestamp,&(tmp),(long)1,(long)1,sizeof(timestamp),
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 78 "rnull.pgc"
+#line 79 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 78 "rnull.pgc"
+#line 79 "rnull.pgc"


     test_null(CCHARTYPE, (char *) c);
@@ -270,23 +271,23 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
     test_null(CDTIMETYPE, (char *) &tmp);

     { ECPGdo(__LINE__, 1, 0, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
-#line 91 "rnull.pgc"
+#line 92 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 91 "rnull.pgc"
+#line 92 "rnull.pgc"

     { ECPGtrans(__LINE__, NULL, "commit");
-#line 92 "rnull.pgc"
+#line 93 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 92 "rnull.pgc"
+#line 93 "rnull.pgc"


     { ECPGdisconnect(__LINE__, "CURRENT");
-#line 94 "rnull.pgc"
+#line 95 "rnull.pgc"

 if (sqlca.sqlcode < 0) sqlprint ( );}
-#line 94 "rnull.pgc"
+#line 95 "rnull.pgc"


     return 0;
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rnull.stderr
b/src/interfaces/ecpg/test/expected/compat_informix-rnull.stderr
index dd3d8b7..1c9b461 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-rnull.stderr
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rnull.stderr
@@ -2,123 +2,123 @@
 [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]: ecpg_execute on line 31: query: create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f
float, l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz ); with 0 parameter(s) on connection
ecpg1_regression
+[NO_PID]: ecpg_execute on line 32: query: create table test ( id int , c char ( 10 ) , s smallint , i int , b bool , f
float, l bigint , dbl double precision , dec decimal , dat date , tmp timestamptz ); with 0 parameter(s) on connection
ecpg1_regression
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 31: using PQexec
+[NO_PID]: ecpg_execute on line 32: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 31: OK: CREATE TABLE
+[NO_PID]: ecpg_process_output on line 32: OK: CREATE TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans on line 34: action "commit"; connection "ecpg1_regression"
+[NO_PID]: ECPGtrans on line 35: action "commit"; connection "ecpg1_regression"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 36: query: insert into test ( id , c , s , i , b , f , l , dbl ) values ( 1 , $1  , $2
,$3  , $4  , $5  , $6  , $7  ); with 7 parameter(s) on connection ecpg1_regression 
+[NO_PID]: ecpg_execute on line 37: query: insert into test ( id , c , s , i , b , f , l , dbl ) values ( 1 , $1  , $2
,$3  , $4  , $5  , $6  , $7  ); with 7 parameter(s) on connection ecpg1_regression 
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 36: using PQexecParams
+[NO_PID]: ecpg_execute on line 37: using PQexecParams
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 36: parameter 1 = abc
+[NO_PID]: ecpg_free_params on line 37: parameter 1 = abc
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 36: parameter 2 = 17
+[NO_PID]: ecpg_free_params on line 37: parameter 2 = 17
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 36: parameter 3 = -74874
+[NO_PID]: ecpg_free_params on line 37: parameter 3 = -74874
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 36: parameter 4 = t
+[NO_PID]: ecpg_free_params on line 37: parameter 4 = t
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 36: parameter 5 = 3.71000003814697
+[NO_PID]: ecpg_free_params on line 37: parameter 5 = 3.71000003814697
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 36: parameter 6 = 487444
+[NO_PID]: ecpg_free_params on line 37: parameter 6 = 487444
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 36: parameter 7 = 404.404
+[NO_PID]: ecpg_free_params on line 37: parameter 7 = 404.404
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 36: OK: INSERT 0 1
+[NO_PID]: ecpg_process_output on line 37: OK: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans on line 39: action "commit"; connection "ecpg1_regression"
+[NO_PID]: ECPGtrans on line 40: action "commit"; connection "ecpg1_regression"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 52: query: insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp )
values( 2 , $1  , $2  , $3  , $4  , $5  , $6  , $7  , $8  , $9  , $10  ); with 10 parameter(s) on connection
ecpg1_regression
+[NO_PID]: ecpg_execute on line 53: query: insert into test ( id , c , s , i , b , f , l , dbl , dec , dat , tmp )
values( 2 , $1  , $2  , $3  , $4  , $5  , $6  , $7  , $8  , $9  , $10  ); with 10 parameter(s) on connection
ecpg1_regression
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 52: using PQexecParams
+[NO_PID]: ecpg_execute on line 53: using PQexecParams
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 52: parameter 1 = null
+[NO_PID]: ecpg_free_params on line 53: parameter 1 = null
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 52: parameter 2 = null
+[NO_PID]: ecpg_free_params on line 53: parameter 2 = null
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 52: parameter 3 = null
+[NO_PID]: ecpg_free_params on line 53: parameter 3 = null
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 52: parameter 4 = t
+[NO_PID]: ecpg_free_params on line 53: parameter 4 = t
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 52: parameter 5 = null
+[NO_PID]: ecpg_free_params on line 53: parameter 5 = null
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 52: parameter 6 = null
+[NO_PID]: ecpg_free_params on line 53: parameter 6 = null
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 52: parameter 7 = null
+[NO_PID]: ecpg_free_params on line 53: parameter 7 = null
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 52: parameter 8 = null
+[NO_PID]: ecpg_free_params on line 53: parameter 8 = null
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 52: parameter 9 = null
+[NO_PID]: ecpg_free_params on line 53: parameter 9 = null
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_free_params on line 52: parameter 10 = null
+[NO_PID]: ecpg_free_params on line 53: parameter 10 = null
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 52: OK: INSERT 0 1
+[NO_PID]: ecpg_process_output on line 53: OK: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans on line 55: action "commit"; connection "ecpg1_regression"
+[NO_PID]: ECPGtrans on line 56: action "commit"; connection "ecpg1_regression"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 59: query: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1;
with0 parameter(s) on connection ecpg1_regression 
+[NO_PID]: ecpg_execute on line 60: query: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 1;
with0 parameter(s) on connection ecpg1_regression 
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 59: using PQexec
+[NO_PID]: ecpg_execute on line 60: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 59: correctly got 1 tuples with 10 fields
+[NO_PID]: ecpg_process_output on line 60: correctly got 1 tuples with 10 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 59: RESULT: abc        offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 60: RESULT: abc        offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 59: RESULT: 17 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 60: RESULT: 17 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 59: RESULT: -74874 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 60: RESULT: -74874 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 59: RESULT: t offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 60: RESULT: t offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 59: RESULT: 3.71000003814697 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 60: RESULT: 3.71000003814697 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 59: RESULT: 487444 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 60: RESULT: 487444 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 59: RESULT: 404.404 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 60: RESULT: 404.404 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 59: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 60: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 59: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 60: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 59: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 60: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 76: query: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2;
with0 parameter(s) on connection ecpg1_regression 
+[NO_PID]: ecpg_execute on line 77: query: select c , s , i , b , f , l , dbl , dec , dat , tmp from test where id = 2;
with0 parameter(s) on connection ecpg1_regression 
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 76: using PQexec
+[NO_PID]: ecpg_execute on line 77: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 76: correctly got 1 tuples with 10 fields
+[NO_PID]: ecpg_process_output on line 77: correctly got 1 tuples with 10 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 76: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 77: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 76: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 77: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 76: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 77: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 76: RESULT: t offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 77: RESULT: t offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 76: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 77: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 76: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 77: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 76: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 77: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 76: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 77: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 76: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 77: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 76: RESULT:  offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 77: RESULT:  offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 91: query: drop table test; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: ecpg_execute on line 92: query: drop table test; with 0 parameter(s) on connection ecpg1_regression
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 91: using PQexec
+[NO_PID]: ecpg_execute on line 92: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 91: OK: DROP TABLE
+[NO_PID]: ecpg_process_output on line 92: OK: DROP TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans on line 92: action "commit"; connection "ecpg1_regression"
+[NO_PID]: ECPGtrans on line 93: action "commit"; connection "ecpg1_regression"
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_finish: connection ecpg1_regression closed
 [NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
index b3e1e75..506bcab 100644
--- a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
+++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #include <limits.h>
 #include <pgtypes_date.h>
 #include <pgtypes_timestamp.h>
@@ -22,7 +23,7 @@



-#line 8 "dt_test2.pgc"
+#line 9 "dt_test2.pgc"


 char *dates[] = { "19990108foobar",
@@ -83,22 +84,22 @@ main(void)



-#line 62 "dt_test2.pgc"
+#line 63 "dt_test2.pgc"
  date date1 ;

-#line 63 "dt_test2.pgc"
+#line 64 "dt_test2.pgc"
  timestamp ts1 , ts2 ;

-#line 64 "dt_test2.pgc"
+#line 65 "dt_test2.pgc"
  char * text ;

-#line 65 "dt_test2.pgc"
+#line 66 "dt_test2.pgc"
  interval * i1 ;

-#line 66 "dt_test2.pgc"
+#line 67 "dt_test2.pgc"
  date * dc ;
 /* exec sql end declare section */
-#line 67 "dt_test2.pgc"
+#line 68 "dt_test2.pgc"


     int i, j;
diff --git a/src/interfaces/ecpg/test/expected/preproc-init.c b/src/interfaces/ecpg/test/expected/preproc-init.c
index b0e0473..84d0066 100644
--- a/src/interfaces/ecpg/test/expected/preproc-init.c
+++ b/src/interfaces/ecpg/test/expected/preproc-init.c
@@ -7,6 +7,8 @@
 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))

 #line 1 "init.pgc"
+#include <stdbool.h>
+

 #line 1 "sqlca.h"
 #ifndef POSTGRES_SQLCA_H
@@ -76,7 +78,7 @@ struct sqlca_t *ECPGget_sqlca(void);

 #endif

-#line 1 "init.pgc"
+#line 3 "init.pgc"


 enum e { ENUM0, ENUM1 };
@@ -149,40 +151,40 @@ int main(void)

           /* = 1L */

-#line 60 "init.pgc"
+#line 62 "init.pgc"
  int a = ( int ) 2 ;

-#line 61 "init.pgc"
+#line 63 "init.pgc"
  int b = 2 + 2 ;

-#line 62 "init.pgc"
+#line 64 "init.pgc"
  int b2 = ( 14 * 7 ) ;

-#line 63 "init.pgc"
+#line 65 "init.pgc"
  int d = x . member ;

-#line 64 "init.pgc"
+#line 66 "init.pgc"
  int g = fb ( 2 ) ;

-#line 65 "init.pgc"
+#line 67 "init.pgc"
  int i = 3 ^ 1 ;

-#line 66 "init.pgc"
+#line 68 "init.pgc"
  int j = 1 ? 1 : 2 ;

-#line 68 "init.pgc"
+#line 70 "init.pgc"
  int e = y -> member ;

-#line 69 "init.pgc"
+#line 71 "init.pgc"
  int c = 10 >> 2 ;

-#line 70 "init.pgc"
+#line 72 "init.pgc"
  bool h = 2 || 1 ;

-#line 71 "init.pgc"
+#line 73 "init.pgc"
  long iay ;
 /* exec sql end declare section */
-#line 72 "init.pgc"
+#line 74 "init.pgc"


     int f=fa();
@@ -191,10 +193,10 @@ int main(void)
     /* exec sql begin declare section */
       /* compile error */

-#line 78 "init.pgc"
+#line 80 "init.pgc"
  int k = N : : i ;
 /* exec sql end declare section */
-#line 79 "init.pgc"
+#line 81 "init.pgc"

 #endif

@@ -204,58 +206,58 @@ int main(void)
     iay = 0;
     printf("%ld\n", iay);
     /* exec sql whenever sqlerror  do fa ( ) ; */
-#line 87 "init.pgc"
-
-    { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
-#line 88 "init.pgc"
-
-if (sqlca.sqlcode < 0) fa ( );}
-#line 88 "init.pgc"
-
-    /* exec sql whenever sqlerror  do fb ( 20 ) ; */
 #line 89 "init.pgc"

     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
 #line 90 "init.pgc"

-if (sqlca.sqlcode < 0) fb ( 20 );}
+if (sqlca.sqlcode < 0) fa ( );}
 #line 90 "init.pgc"

-    /* exec sql whenever sqlerror  do fc ( \"50\" ) ; */
+    /* exec sql whenever sqlerror  do fb ( 20 ) ; */
 #line 91 "init.pgc"

     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
 #line 92 "init.pgc"

-if (sqlca.sqlcode < 0) fc ( "50" );}
+if (sqlca.sqlcode < 0) fb ( 20 );}
 #line 92 "init.pgc"

-    /* exec sql whenever sqlerror  do fd ( \"50\" , 1 ) ; */
+    /* exec sql whenever sqlerror  do fc ( \"50\" ) ; */
 #line 93 "init.pgc"

     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
 #line 94 "init.pgc"

-if (sqlca.sqlcode < 0) fd ( "50" , 1 );}
+if (sqlca.sqlcode < 0) fc ( "50" );}
 #line 94 "init.pgc"

-    /* exec sql whenever sqlerror  do fe ( ENUM0 ) ; */
+    /* exec sql whenever sqlerror  do fd ( \"50\" , 1 ) ; */
 #line 95 "init.pgc"

     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
 #line 96 "init.pgc"

-if (sqlca.sqlcode < 0) fe ( ENUM0 );}
+if (sqlca.sqlcode < 0) fd ( "50" , 1 );}
 #line 96 "init.pgc"

-    /* exec sql whenever sqlerror  do sqlnotice ( NULL , 0 ) ; */
+    /* exec sql whenever sqlerror  do fe ( ENUM0 ) ; */
 #line 97 "init.pgc"

     { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
 #line 98 "init.pgc"

-if (sqlca.sqlcode < 0) sqlnotice ( NULL , 0 );}
+if (sqlca.sqlcode < 0) fe ( ENUM0 );}
 #line 98 "init.pgc"

+    /* exec sql whenever sqlerror  do sqlnotice ( NULL , 0 ) ; */
+#line 99 "init.pgc"
+
+    { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
+#line 100 "init.pgc"
+
+if (sqlca.sqlcode < 0) sqlnotice ( NULL , 0 );}
+#line 100 "init.pgc"
+
     return 0;
 }
diff --git a/src/interfaces/ecpg/test/expected/preproc-init.stderr
b/src/interfaces/ecpg/test/expected/preproc-init.stderr
index 1b6fa18..c159d45 100644
--- a/src/interfaces/ecpg/test/expected/preproc-init.stderr
+++ b/src/interfaces/ecpg/test/expected/preproc-init.stderr
@@ -1,7 +1,5 @@
 [NO_PID]: ECPGdebug: set to 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -220 on line 88: connection "NULL" does not exist on line 88
-[NO_PID]: sqlca: code: -220, state: 08003
 [NO_PID]: raising sqlcode -220 on line 90: connection "NULL" does not exist on line 90
 [NO_PID]: sqlca: code: -220, state: 08003
 [NO_PID]: raising sqlcode -220 on line 92: connection "NULL" does not exist on line 92
@@ -12,3 +10,5 @@
 [NO_PID]: sqlca: code: -220, state: 08003
 [NO_PID]: raising sqlcode -220 on line 98: connection "NULL" does not exist on line 98
 [NO_PID]: sqlca: code: -220, state: 08003
+[NO_PID]: raising sqlcode -220 on line 100: connection "NULL" does not exist on line 100
+[NO_PID]: sqlca: code: -220, state: 08003
diff --git a/src/interfaces/ecpg/test/expected/sql-dyntest.c b/src/interfaces/ecpg/test/expected/sql-dyntest.c
index 513d44c..20a8db7 100644
--- a/src/interfaces/ecpg/test/expected/sql-dyntest.c
+++ b/src/interfaces/ecpg/test/expected/sql-dyntest.c
@@ -12,6 +12,7 @@

 #include <stdio.h>
 #include <stdlib.h>
+#include <stdbool.h>


 #line 1 "sql3types.h"
@@ -59,7 +60,7 @@ enum

 #endif                            /* !_ECPG_SQL3TYPES_H */

-#line 7 "dyntest.pgc"
+#line 8 "dyntest.pgc"


 #line 1 "sqlca.h"
@@ -130,7 +131,7 @@ struct sqlca_t *ECPGget_sqlca(void);

 #endif

-#line 8 "dyntest.pgc"
+#line 9 "dyntest.pgc"


 #line 1 "regression.h"
@@ -140,7 +141,7 @@ struct sqlca_t *ECPGget_sqlca(void);



-#line 9 "dyntest.pgc"
+#line 10 "dyntest.pgc"


 static void
@@ -160,47 +161,51 @@ main ()



-
+
+




-#line 22 "dyntest.pgc"
- int COUNT ;
-
 #line 23 "dyntest.pgc"
- int INTVAR ;
+ int COUNT ;

 #line 24 "dyntest.pgc"
- int INDEX ;
+ int INTVAR ;

 #line 25 "dyntest.pgc"
- int INDICATOR ;
+ int INDEX ;

 #line 26 "dyntest.pgc"
- int TYPE , LENGTH , OCTET_LENGTH , PRECISION , SCALE , RETURNED_OCTET_LENGTH ;
+ int INDICATOR ;

 #line 27 "dyntest.pgc"
- int DATETIME_INTERVAL_CODE ;
+ int TYPE , LENGTH , OCTET_LENGTH , PRECISION , SCALE , RETURNED_OCTET_LENGTH ;

 #line 28 "dyntest.pgc"
- char NAME [ 120 ] , BOOLVAR ;
+ int DATETIME_INTERVAL_CODE ;

 #line 29 "dyntest.pgc"
- char STRINGVAR [ 1024 ] ;
+ char NAME [ 120 ] ;

 #line 30 "dyntest.pgc"
- double DOUBLEVAR ;
+ bool BOOLVAR ;

 #line 31 "dyntest.pgc"
+ char STRINGVAR [ 1024 ] ;
+
+#line 32 "dyntest.pgc"
+ double DOUBLEVAR ;
+
+#line 33 "dyntest.pgc"
  char * QUERY ;
 /* exec sql end declare section */
-#line 32 "dyntest.pgc"
+#line 34 "dyntest.pgc"

   int done = 0;

   /* exec sql var BOOLVAR is bool */
-#line 35 "dyntest.pgc"
+#line 37 "dyntest.pgc"


   ECPGdebug (1, stderr);
@@ -208,66 +213,66 @@ main ()
   QUERY = "select * from dyntest";

   /* exec sql whenever sqlerror  do error ( ) ; */
-#line 43 "dyntest.pgc"
+#line 45 "dyntest.pgc"


   ECPGallocate_desc(__LINE__, "MYDESC");
-#line 45 "dyntest.pgc"
+#line 47 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );
-#line 45 "dyntest.pgc"
+#line 47 "dyntest.pgc"


   { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
-#line 47 "dyntest.pgc"
+#line 49 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 47 "dyntest.pgc"
+#line 49 "dyntest.pgc"


   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to german", ECPGt_EOIT, ECPGt_EORT);
-#line 49 "dyntest.pgc"
+#line 51 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 49 "dyntest.pgc"
+#line 51 "dyntest.pgc"


   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table dyntest ( name char ( 14 ) , d float8 , i int ,
bignumberint8 , b boolean , comment text , day date )", ECPGt_EOIT, ECPGt_EORT); 
-#line 53 "dyntest.pgc"
+#line 55 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 53 "dyntest.pgc"
+#line 55 "dyntest.pgc"

   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into dyntest values ( 'first entry' , 14.7 , 14 ,
123045607890, true , 'The world''s most advanced open source database.' , '1987-07-14' )", ECPGt_EOIT, ECPGt_EORT); 
-#line 54 "dyntest.pgc"
+#line 56 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 54 "dyntest.pgc"
+#line 56 "dyntest.pgc"

   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into dyntest values ( 'second entry' , 1407.87 , 1407 ,
987065403210, false , 'The elephant never forgets.' , '1999-11-5' )", ECPGt_EOIT, ECPGt_EORT); 
-#line 55 "dyntest.pgc"
+#line 57 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 55 "dyntest.pgc"
+#line 57 "dyntest.pgc"


   { ECPGprepare(__LINE__, NULL, 0, "myquery", QUERY);
-#line 57 "dyntest.pgc"
+#line 59 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 57 "dyntest.pgc"
+#line 59 "dyntest.pgc"

   /* declare MYCURS cursor for $1 */
-#line 58 "dyntest.pgc"
+#line 60 "dyntest.pgc"


   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare MYCURS cursor for $1",
     ECPGt_char_variable,(ECPGprepared_statement(NULL, "myquery", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 60 "dyntest.pgc"
+#line 62 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 60 "dyntest.pgc"
+#line 62 "dyntest.pgc"


   while (1)
@@ -275,10 +280,10 @@ if (sqlca.sqlcode < 0) error ( );}
       { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch in MYCURS", ECPGt_EOIT,
     ECPGt_descriptor, "MYDESC", 1L, 1L, 1L,
     ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 64 "dyntest.pgc"
+#line 66 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 64 "dyntest.pgc"
+#line 66 "dyntest.pgc"


       if (sqlca.sqlcode)
@@ -286,10 +291,10 @@ if (sqlca.sqlcode < 0) error ( );}

       { ECPGget_desc_header(__LINE__, "MYDESC", &(COUNT));

-#line 69 "dyntest.pgc"
+#line 71 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 69 "dyntest.pgc"
+#line 71 "dyntest.pgc"

       if (!done)
     {
@@ -309,10 +314,10 @@ if (sqlca.sqlcode < 0) error ( );}
     ECPGt_int,&(LENGTH),(long)1,(long)1,sizeof(int), ECPGd_type,
     ECPGt_int,&(TYPE),(long)1,(long)1,sizeof(int), ECPGd_EODT);

-#line 86 "dyntest.pgc"
+#line 88 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 86 "dyntest.pgc"
+#line 88 "dyntest.pgc"

       printf ("%2d\t%s (type: %d length: %d precision: %d scale: %d = " , INDEX, NAME, TYPE, LENGTH, PRECISION,
SCALE);
       switch (TYPE)
@@ -345,10 +350,10 @@ if (sqlca.sqlcode < 0) error ( );}
         { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_di_code,
     ECPGt_int,&(DATETIME_INTERVAL_CODE),(long)1,(long)1,sizeof(int), ECPGd_EODT);

-#line 116 "dyntest.pgc"
+#line 118 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 116 "dyntest.pgc"
+#line 118 "dyntest.pgc"

           switch (DATETIME_INTERVAL_CODE)
         {
@@ -399,10 +404,10 @@ if (sqlca.sqlcode < 0) error ( );}
           { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
     ECPGt_bool,&(BOOLVAR),(long)1,(long)1,sizeof(bool), ECPGd_EODT);

-#line 163 "dyntest.pgc"
+#line 165 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 163 "dyntest.pgc"
+#line 165 "dyntest.pgc"

         printf ("%s\n", BOOLVAR ? "true" : "false");
         break;
@@ -411,10 +416,10 @@ if (sqlca.sqlcode < 0) error ( );}
           { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
     ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);

-#line 168 "dyntest.pgc"
+#line 170 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 168 "dyntest.pgc"
+#line 170 "dyntest.pgc"

         printf ("%d\n", INTVAR);
         break;
@@ -422,10 +427,10 @@ if (sqlca.sqlcode < 0) error ( );}
           { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
     ECPGt_double,&(DOUBLEVAR),(long)1,(long)1,sizeof(double), ECPGd_EODT);

-#line 172 "dyntest.pgc"
+#line 174 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 172 "dyntest.pgc"
+#line 174 "dyntest.pgc"

         printf ("%.*f\n", PRECISION, DOUBLEVAR);
         break;
@@ -434,10 +439,10 @@ if (sqlca.sqlcode < 0) error ( );}
     ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_di_code,
     ECPGt_int,&(DATETIME_INTERVAL_CODE),(long)1,(long)1,sizeof(int), ECPGd_EODT);

-#line 178 "dyntest.pgc"
+#line 180 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 178 "dyntest.pgc"
+#line 180 "dyntest.pgc"

         printf ("%d \"%s\"\n", DATETIME_INTERVAL_CODE, STRINGVAR);
         break;
@@ -446,10 +451,10 @@ if (sqlca.sqlcode < 0) error ( );}
           { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
     ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);

-#line 183 "dyntest.pgc"
+#line 185 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 183 "dyntest.pgc"
+#line 185 "dyntest.pgc"

         printf ("\"%s\"\n", STRINGVAR);
         break;
@@ -457,10 +462,10 @@ if (sqlca.sqlcode < 0) error ( );}
           { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
     ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);

-#line 187 "dyntest.pgc"
+#line 189 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 187 "dyntest.pgc"
+#line 189 "dyntest.pgc"

         printf ("<\"%s\">\n", STRINGVAR);
         break;
@@ -469,17 +474,17 @@ if (sqlca.sqlcode < 0) error ( );}
     }

   { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close MYCURS", ECPGt_EOIT, ECPGt_EORT);
-#line 194 "dyntest.pgc"
+#line 196 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );}
-#line 194 "dyntest.pgc"
+#line 196 "dyntest.pgc"


   ECPGdeallocate_desc(__LINE__, "MYDESC");
-#line 196 "dyntest.pgc"
+#line 198 "dyntest.pgc"

 if (sqlca.sqlcode < 0) error ( );
-#line 196 "dyntest.pgc"
+#line 198 "dyntest.pgc"


   return 0;
diff --git a/src/interfaces/ecpg/test/expected/sql-dyntest.stderr
b/src/interfaces/ecpg/test/expected/sql-dyntest.stderr
index f0b21b0..a79fdd8 100644
--- a/src/interfaces/ecpg/test/expected/sql-dyntest.stderr
+++ b/src/interfaces/ecpg/test/expected/sql-dyntest.stderr
@@ -2,45 +2,45 @@
 [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]: ecpg_execute on line 49: query: set datestyle to german; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: ecpg_execute on line 51: query: set datestyle to german; with 0 parameter(s) on connection ecpg1_regression
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 49: using PQexec
+[NO_PID]: ecpg_execute on line 51: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 49: OK: SET
+[NO_PID]: ecpg_process_output on line 51: OK: SET
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 51: query: create table dyntest ( name char ( 14 ) , d float8 , i int , bignumber int8
,b boolean , comment text , day date ); with 0 parameter(s) on connection ecpg1_regression 
+[NO_PID]: ecpg_execute on line 53: query: create table dyntest ( name char ( 14 ) , d float8 , i int , bignumber int8
,b boolean , comment text , day date ); with 0 parameter(s) on connection ecpg1_regression 
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 51: using PQexec
+[NO_PID]: ecpg_execute on line 53: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 51: OK: CREATE TABLE
+[NO_PID]: ecpg_process_output on line 53: OK: CREATE TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 54: query: insert into dyntest values ( 'first entry' , 14.7 , 14 , 123045607890 , true
,'The world''s most advanced open source database.' , '1987-07-14' ); with 0 parameter(s) on connection
ecpg1_regression
+[NO_PID]: ecpg_execute on line 56: query: insert into dyntest values ( 'first entry' , 14.7 , 14 , 123045607890 , true
,'The world''s most advanced open source database.' , '1987-07-14' ); with 0 parameter(s) on connection
ecpg1_regression
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 54: using PQexec
+[NO_PID]: ecpg_execute on line 56: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 54: OK: INSERT 0 1
+[NO_PID]: ecpg_process_output on line 56: OK: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 55: query: insert into dyntest values ( 'second entry' , 1407.87 , 1407 , 987065403210
,false , 'The elephant never forgets.' , '1999-11-5' ); with 0 parameter(s) on connection ecpg1_regression 
+[NO_PID]: ecpg_execute on line 57: query: insert into dyntest values ( 'second entry' , 1407.87 , 1407 , 987065403210
,false , 'The elephant never forgets.' , '1999-11-5' ); with 0 parameter(s) on connection ecpg1_regression 
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 55: using PQexec
+[NO_PID]: ecpg_execute on line 57: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 55: OK: INSERT 0 1
+[NO_PID]: ecpg_process_output on line 57: OK: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: prepare_common on line 57: name myquery; query: "select * from dyntest"
+[NO_PID]: prepare_common on line 59: name myquery; query: "select * from dyntest"
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 60: query: declare MYCURS cursor for select * from dyntest; with 0 parameter(s) on
connectionecpg1_regression 
+[NO_PID]: ecpg_execute on line 62: query: declare MYCURS cursor for select * from dyntest; with 0 parameter(s) on
connectionecpg1_regression 
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 60: using PQexec
+[NO_PID]: ecpg_execute on line 62: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 60: OK: DECLARE CURSOR
+[NO_PID]: ecpg_process_output on line 62: OK: DECLARE CURSOR
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 64: query: fetch in MYCURS; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: ecpg_execute on line 66: query: fetch in MYCURS; with 0 parameter(s) on connection ecpg1_regression
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 64: using PQexec
+[NO_PID]: ecpg_execute on line 66: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 64: correctly got 1 tuples with 7 fields
+[NO_PID]: ecpg_process_output on line 66: correctly got 1 tuples with 7 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 64: putting result (1 tuples) into descriptor MYDESC
+[NO_PID]: ecpg_process_output on line 66: putting result (1 tuples) into descriptor MYDESC
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc_header: found 7 attributes
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -64,7 +64,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 183: RESULT: first entry    offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 185: RESULT: first entry    offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 2
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -86,7 +86,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 2
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 172: RESULT: 14.7 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 174: RESULT: 14.7 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 3
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -108,7 +108,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 3
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 168: RESULT: 14 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 170: RESULT: 14 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 4
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -130,7 +130,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 4
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 187: RESULT: 123045607890 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 189: RESULT: 123045607890 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 5
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -152,7 +152,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 163: RESULT: t offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 165: RESULT: t offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 6
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -174,7 +174,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 183: RESULT: The world's most advanced open source database. offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 185: RESULT: The world's most advanced open source database. offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 7
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -202,15 +202,15 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: TYPE = 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 176: RESULT: 14.07.1987 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 178: RESULT: 14.07.1987 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 64: query: fetch in MYCURS; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: ecpg_execute on line 66: query: fetch in MYCURS; with 0 parameter(s) on connection ecpg1_regression
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 64: using PQexec
+[NO_PID]: ecpg_execute on line 66: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 64: correctly got 1 tuples with 7 fields
+[NO_PID]: ecpg_process_output on line 66: correctly got 1 tuples with 7 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 64: putting result (1 tuples) into descriptor MYDESC
+[NO_PID]: ecpg_process_output on line 66: putting result (1 tuples) into descriptor MYDESC
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc_header: found 7 attributes
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -234,7 +234,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 183: RESULT: second entry   offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 185: RESULT: second entry   offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 2
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -256,7 +256,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 2
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 172: RESULT: 1407.87 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 174: RESULT: 1407.87 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 3
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -278,7 +278,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 3
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 168: RESULT: 1407 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 170: RESULT: 1407 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 4
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -300,7 +300,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 4
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 187: RESULT: 987065403210 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 189: RESULT: 987065403210 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 5
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -322,7 +322,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 163: RESULT: f offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 165: RESULT: f offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 6
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -344,7 +344,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 183: RESULT: The elephant never forgets. offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 185: RESULT: The elephant never forgets. offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 7
 [NO_PID]: sqlca: code: 0, state: 00000
@@ -372,19 +372,19 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: TYPE = 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 176: RESULT: 05.11.1999 offset: -1; array: no
+[NO_PID]: ecpg_get_data on line 178: RESULT: 05.11.1999 offset: -1; array: no
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 64: query: fetch in MYCURS; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: ecpg_execute on line 66: query: fetch in MYCURS; with 0 parameter(s) on connection ecpg1_regression
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 64: using PQexec
+[NO_PID]: ecpg_execute on line 66: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 64: correctly got 0 tuples with 7 fields
+[NO_PID]: ecpg_process_output on line 66: correctly got 0 tuples with 7 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 on line 64: no data found on line 64
+[NO_PID]: raising sqlcode 100 on line 66: no data found on line 66
 [NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ecpg_execute on line 194: query: close MYCURS; with 0 parameter(s) on connection ecpg1_regression
+[NO_PID]: ecpg_execute on line 196: query: close MYCURS; with 0 parameter(s) on connection ecpg1_regression
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 194: using PQexec
+[NO_PID]: ecpg_execute on line 196: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 194: OK: CLOSE CURSOR
+[NO_PID]: ecpg_process_output on line 196: OK: CLOSE CURSOR
 [NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc b/src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc
index 62b934b..55870b1 100644
--- a/src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc
+++ b/src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #include <limits.h>
 #include <pgtypes_date.h>
 #include <pgtypes_timestamp.h>
diff --git a/src/interfaces/ecpg/test/preproc/init.pgc b/src/interfaces/ecpg/test/preproc/init.pgc
index b1f7199..023aa4b 100644
--- a/src/interfaces/ecpg/test/preproc/init.pgc
+++ b/src/interfaces/ecpg/test/preproc/init.pgc
@@ -1,3 +1,5 @@
+#include <stdbool.h>
+
 exec sql include sqlca;

 enum e { ENUM0, ENUM1 };
diff --git a/src/interfaces/ecpg/test/sql/dyntest.pgc b/src/interfaces/ecpg/test/sql/dyntest.pgc
index 5f02fd5..f2a9cc2 100644
--- a/src/interfaces/ecpg/test/sql/dyntest.pgc
+++ b/src/interfaces/ecpg/test/sql/dyntest.pgc
@@ -3,6 +3,7 @@

 #include <stdio.h>
 #include <stdlib.h>
+#include <stdbool.h>

 exec sql include sql3types;
 exec sql include sqlca;
@@ -25,7 +26,8 @@ main ()
   int INDICATOR;
   int TYPE, LENGTH, OCTET_LENGTH, PRECISION, SCALE, RETURNED_OCTET_LENGTH;
   int DATETIME_INTERVAL_CODE;
-  char NAME[120], BOOLVAR;
+  char NAME[120];
+  bool BOOLVAR;
   char STRINGVAR[1024];
   double DOUBLEVAR;
   char *QUERY;

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: idea: log_statement_sample_rate - bottom limit for sampling
Next
From: Tomas Vondra
Date:
Subject: Re: Using multiple extended statistics for estimates