segmentation fault on Dynamic query using C - Mailing list pgsql-bugs

From Priyank Raj
Subject segmentation fault on Dynamic query using C
Date
Msg-id 1b493db80901212210g4286465ag42ff00a2a730641c@mail.gmail.com
Whole thread Raw
Responses Re: segmentation fault on Dynamic query using C
List pgsql-bugs
I have a code(mention below), when i run this code on Intel machine it works
perfectly fine, but when i use AMD machine it giving me segmentation fault
at "EXEC SQL EXECUTE IMMEDIATE :qqq;" line. what could be the problem??

int main(int argc,char *argv[])
{

       EXEC SQL BEGIN DECLARE SECTION;
        const char *qqq = "insert into strands (id,filename,length,seq)
values(0,\'1\',2,\'{\"C\",\"A\"}\')";
        char database[256],target[1024],host[256],user[256];
        EXEC SQL END DECLARE SECTION;

        exec sql whenever sqlerror sqlprint;

        sprintf(target,"mydb@localhost");
        ECPGdebug(1, stdout);

        EXEC SQL CONNECT TO :target user priyank;

       printf("1..\n");
                EXEC SQL EXECUTE IMMEDIATE :qqq;
       printf("2..\n");
                EXEC SQL COMMIT;
       printf("3..\n");

        EXEC SQL DISCONNECT;
        return 1;
}

i am using followinf command to make executable file

ecpg filename.pgc
gcc -Wall -o filename filename.o  -lecpg -L/usr/local/pgsql/lib
-I/usr/local/pgsql/include -lcrypt

Thanks
Priyank Raj

pgsql-bugs by date:

Previous
From: Kent Tong
Date:
Subject: error reading c:\Program Files\PostgreSQL\8.3\data\postgresql.conf during installation
Next
From: Michael Meskes
Date:
Subject: Re: segmentation fault on Dynamic query using C