Skip site navigation (1) Skip section navigation (2)

Re: ecpg "aborts" on structure reference

From: Tim Nelson <TNELSON(at)ECS-INC(dot)com>
To: "'pgsql-bugs(at)postgresql(dot)org'" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: ecpg "aborts" on structure reference
Date: 2002-01-09 16:16:43
Message-ID: 63BD6AB4FBBED411B3E20004ACAE8B63014457@str_nt01.ecs-inc.com (view raw or flat)
Thread:
Lists: pgsql-bugs
This is NOT fixed in 2.9.  It seems to have something
to with parsing the structure definitions, here is a more
complete case:

exec sql include    sqlca;

exec sql type  APC_LAYO_FLD is struct {
   long apcl_id;
   char apclf_sect_flg[2];
};

exec sql type  APC_LAYOUT is struct {
   long apcl_id;
};

exec sql begin declare section;
   APC_LAYOUT     PL;
   APC_LAYO_FLD   PLF;
   char curr_sect[5];
exec sql end declare section;

   int
print_template()
{
      if (1) {
         exec sql declare fld_curs cursor for
            select apc_layo_fld.*
               from apc_layo_fld
               where apcl_id = :PL.apcl_id
                 and apclf_sect_flg = :curr_sect
            order by apclf_ln_nbr, apclf_col_nbr;
      }
      exec sql open fld_curs;
}

Three things I have been able to do to make ecpg NOT crash:

1. remove the "if" block.
2. "long apcl_id;" in the first structure definition.
3. reverse the entries of the structure host variables.

Thanks again.

-----Original Message-----
From: Tim Nelson [mailto:TNELSON(at)ecs-inc(dot)com]
Sent: Wednesday, January 09, 2002 8:26 AM
To: 'pgsql-bugs(at)postgresql(dot)org'
Subject: [BUGS] ecpg "aborts" on structure reference


Think I've identified a bug in ecpg 2.8 (RH7.1) the following
code aborts (crashes) ecpg:

exec sql include     sqlca;
exec sql include     ../../libhome/dbincs/apc_layout.h;
exec sql include     ../../libhome/dbincs/apc_layo_fld.h;

   static int
get_org_name()
{
   exec sql begin declare section;
   APC_LAYOUT     PL;
   APC_LAYO_FLD   PLF;
   char           curr_sect[2];
   exec sql end declare section;

   if (1) {
      exec sql declare fld_curs cursor for
         select apc_layo_fld.*
            from apc_layo_fld
            where apcl_id = :PL.apcl_id
              and apclf_sect_flg = :curr_sect
         order by apclf_ln_nbr, apclf_col_nbr;
   }


   exec sql open fld_curs;
}

... key line here is "where apcl_id = :PL.apcl_id" if I replace
it with "where apcl_id = 1" ... ecpg no longer crashes.

If this has been fixed in 2.9, I would be happy to beta it since
I am porting more that million lines of code from Informix ESQL to
Postgres.  I am not sure how to get the latest version since
I am new to the open source game.

Thanks.
Tim Nelson

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

pgsql-bugs by date

Next:From: Mike HoolehanDate: 2002-01-09 16:42:45
Subject: case-sensitivity inconsistency in quoted column aliases in FROM subselects
Previous:From: pgsql-bugsDate: 2002-01-09 14:52:14
Subject: Bug #558: JDBC InputStream.read() from oid returns incorrect values for negative bytes and really messes up -1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group