ecpg 2.8.0 fails to handle struct properly - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject ecpg 2.8.0 fails to handle struct properly
Date
Msg-id 200108190959.f7J9xBR38176@hub.org
Whole thread Raw
List pgsql-bugs
Clifford T. Matthews (ctm@ardi.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
codeon 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
ecpgversion 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
ecpgwill 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

pgsql-bugs by date:

Previous
From: "Akira Kumakiri"
Date:
Subject: Re: JDBC Large Object getBinaryStream returns -1 before EOF
Next
From: "Truong, Long"
Date:
Subject: openVMS