The following bug has been logged online: Bug reference: 1292 Logged by: shigeto aya
Email address: [EMAIL PROTECTED] PostgreSQL version: 7.4.2 Operating system: Red Hat Linux Advanced Server release 2.1AS/i686 (Pensacola) Description: ecpg precompile bug (valiable typedef & define ) Details: The result to demand cannot be found although the following programs were performed. Demand : data insert ------ 100 200 300 400 500 600 700 800 select ------ 100 200 300 400 500 600 700 800 Execution result data insert ------ 100 200 300 400 500 600 700 800 select ------ 1 200 300 400 5 600 700 800 sample program ------------------------- #include <stdio.h> /* */ /* create table test_table ( retu text ); */ /* */ int main() { #define LEN 3 exec sql begin declare section; typedef char TYPE1[LEN+1]; typedef char TYPE2[3+1]; struct { TYPE1 val1; /* NG */ TYPE2 val2; /* OK */ char val3[LEN+1]; /* OK */ char val4[3+1]; /* OK */ } k ; TYPE1 val5; /* NG */ TYPE2 val6; /* OK */ char val7[3+1]; /* OK */ char val8[LEN+1]; /* OK */ char fetch_val[4]; exec sql end declare section; exec sql connect to aya; exec sql begin work; printf("data insert ------ \n"); strcpy ( k.val1, "100"); printf("%s\n", k.val1); strcpy ( k.val2, "200"); printf("%s\n", k.val2); strcpy ( k.val3, "300"); printf("%s\n", k.val3); strcpy ( k.val4, "400"); printf("%s\n", k.val4); strcpy ( val5, "500"); printf("%s\n", val5); strcpy ( val6, "600"); printf("%s\n", val6); strcpy ( val7, "700"); printf("%s\n", val7); strcpy ( val8, "800"); printf("%s\n", val8); exec sql delete from test_table; exec sql insert into test_table values ( :k.val1 ) ; /* bug ? */ exec sql insert into test_table values ( :k.val2 ) ; /* ok */ exec sql insert into test_table values ( :k.val3 ) ; /* ok */ exec sql insert into test_table values ( :k.val4 ) ; /* ok */ exec sql insert into test_table values ( :val5 ) ; /* bug ? */ exec sql insert into test_table values ( :val6 ) ; /* ok */ exec sql insert into test_table values ( :val7 ) ; /* ok */ exec sql insert into test_table values ( :val8 ) ; /* ok */ exec sql declare acur cursor for select retu1 from test_table ; exec sql open acur; printf("select ------ \n"); while(1) { memset ( fetch_val, '\0', sizeof ( fetch_val ) ); exec sql fetch acur into :fetch_val ; if (sqlca.sqlcode != 0 ){ break; } printf ("%s\n",fetch_val); } exec sql commit work; exec sql disconnect; exit( 0 ); } ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]