dbTalk Databases Forums  

[BUGS] BUG #1292: ecpg precompile bug (valiable typedef & define )

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1292: ecpg precompile bug (valiable typedef & define ) in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
PostgreSQL Bugs List
 
Posts: n/a

Default [BUGS] BUG #1292: ecpg precompile bug (valiable typedef & define ) - 10-24-2004 , 08:32 PM







The following bug has been logged online:

Bug reference: 1292
Logged by: shigeto aya

Email address: shigeto_aya_za (AT) mail (DOT) toyota.co.jp

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 majordomo (AT) postgresql (DOT) org

Reply With Quote
  #2  
Old   
Michael Meskes
 
Posts: n/a

Default Re: [BUGS] BUG #1292: ecpg precompile bug (valiable typedef & define ) - 12-06-2004 , 02:38 PM






On Mon, Oct 25, 2004 at 02:22:37AM +0100, PostgreSQL Bugs List wrote:
Quote:
Description: ecpg precompile bug (valiable typedef & define )

Details:

The result to demand cannot be found although the following programs were
performed.
Fix just committed. Thanks for the report.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes (AT) jabber (DOT) org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.