ecpg 2.8.0 fails to handle struct properly

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: ecpg 2.8.0 fails to handle struct properly
Date: 2001-08-19 09:59:11
Message-ID: 200108190959.f7J9xBR38176@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Clifford T. Matthews (ctm(at)ardi(dot)com) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
ecpg 2.8.0 fails to handle struct properly

Long Description
When I upgraded from postgresql 7.0.3 to 7.1.1 and 7.1.2, certain
parts of my ECPG-using code stopped working. I have extracted some
of my code into a fairly small test case presented below. I can actually use ecpg version 2.7.1 to pre-process the code on my 7.0.3 system and then compile and run the pre-processed code on a 7.1.2 system without trouble. If I use ecpg version 2.8.0 that comes with 7.1.2, the program produces this error message (repeatedly):

[553]: create_statement: invalid statement name

The output from the two different versions of ecpg is sufficiently different that my guess is someone familiar with ecpg will be able to see what's wrong with the new version fairly easily.

I built postgres 7.1.2 using the postgresql-7.1.2-7.src.rpm from Red Hat's rawhide SRPM.

Sample Code
HERE is a create table statement you can use for this test:

create table racks (player_id int4, index int2, balance int4, unique(player_id, index), check ( balance >= 0));

HERE IS postgres_test.c_ecpg (use ecpg -t)

exec sql include pgsql/sqlca;

exec sql type rack_recovery_info_t is struct
{
int player_id;
int index;
int balance;
};

typedef struct
{
int player_id;
int index;
int balance;
}
rack_recovery_info_t;

int
main(void)
{
ECPGdebug(1, stderr);
exec sql connect to ctm as ctm;

exec sql begin;
exec sql declare cur11 cursor for
select player_id,index,balance from racks where balance > 0;

exec sql open cur11;
if (sqlca.sqlcode != 0)
{
printf ("sqlca.sqlcode = %ld", sqlca.sqlcode);
}
else
{
exec sql whenever not found do break;
while (1)
{
exec sql begin declare section;
rack_recovery_info_t temp;
exec sql end declare section;

exec sql fetch cur11 into :temp;
/* exec sql fetch cur11 into :temp.player_id, :temp.index,
:temp.balance; */
printf ("fetch cur11");
}
exec sql whenever not found do no_op_macro();
}
exec sql close cur11;
exec sql end;

return 0;
}

No file was uploaded with this report

Browse pgsql-bugs by date

  From Date Subject
Next Message Erik Luke 2001-08-20 10:21:43 user authentication crash
Previous Message Hans-Jürgen Schönig 2001-08-19 09:40:24 Building 7.1.3 with PL/Perl support on RedHat