ecpg produces code that won't compile - Mailing list pgsql-bugs

From Steve Clark
Subject ecpg produces code that won't compile
Date
Msg-id 47C87940.4010708@netwolves.com
Whole thread Raw
Responses Re: ecpg produces code that won't compile  (Euler Taveira de Oliveira <euler@timbira.com>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4001
Logged by:          Stephen Clark
Email address:      sclark@netwolves.com
PostgreSQL version: 8.3.0
Operating system:   FreeBSD 6.2
Description:        ecpg produces code that won't compile
Details:

Below is a code fragment that compiled and worked fine from 7.3.x thru
8.2.6. With 8.3.0 the compilation phase fails.
--------------------------------------------
exec sql include sqlca;

EXEC SQL WHENEVER NOT FOUND CONTINUE;

int getUnitData()
{

     exec sql begin declare section;

         VARCHAR h_unit_serial_no  [ 15+1];



         // we do an array fetch on these 30 is the max number for these
         int     h_remote_int_netmask    [4096];
         int     h_local_int_netmask     [4096];
         VARCHAR h_tunnel_active         [4096][   1+1];
         VARCHAR h_tunnel_config_type    [4096][   1+1];
         VARCHAR h_local_vpn_int_ip      [4096][  20+1];
         VARCHAR h_local_vpn_ext_ip      [4096][  20+1];
         VARCHAR h_remote_vpn_int_ip     [4096][  20+1];
         VARCHAR h_remote_vpn_ext_ip     [4096][  20+1];

     exec sql end declare section;


         exec sql select tunnel_active,
                         tunnel_config_type,
                         host(local_int_gw_ip),
                         host(local_ext_gw_ip),
                         host(remote_int_gw_ip),
                         host(remote_ext_gw_ip),
                         masklen(remote_int_gw_ip),
                         masklen(local_int_gw_ip)
                 into    :h_tunnel_active,
                         :h_tunnel_config_type,
                         :h_local_vpn_int_ip,
                         :h_local_vpn_ext_ip,
                         :h_remote_vpn_int_ip,
                         :h_remote_vpn_ext_ip,
                         :h_remote_int_netmask,
                         :h_local_int_netmask
                 from t_vpn_tunnel_status
                 where unit_serial_no = :h_unit_serial_no
             order by oid;
             /*limit 30;*/




     return TRUE;
}

/usr/local/bin/ecpg -I/usr/local/include/pgsql -I/usr/local/include
ecpg_test.pgc
mkdep -O2 -Wall -DDEBUG -I../include -I/usr/local/include/pgsql
-I/usr/local/include -I../common crypt_file.c mailuser.c
srm2_monitor_server.c putfiles.c srm2_server_funcs.c escalate.c
packet_loss.c srm2_cron.c srm2_db_funcs.c srm2_monitor_db.c ecpg_test.c
g++ -O2 -Wall -DDEBUG -I../include -I/usr/local/include/pgsql
-I/usr/local/include -I../common -c ecpg_test.c
ecpg_test.pgc: In function `int getUnitData()':
ecpg_test.pgc:36: error: invalid application of `sizeof' to incomplete
type
`varchar_h_tunnel_active'
ecpg_test.pgc:38: error: invalid application of `sizeof' to incomplete
type
`varchar_h_tunnel_config_type'
ecpg_test.pgc:40: error: invalid application of `sizeof' to incomplete
type
`varchar_h_local_vpn_int_ip'
ecpg_test.pgc:42: error: invalid application of `sizeof' to incomplete
type
`varchar_h_local_vpn_ext_ip'
ecpg_test.pgc:44: error: invalid application of `sizeof' to incomplete
type
`varchar_h_remote_vpn_int_ip'
ecpg_test.pgc:46: error: invalid application of `sizeof' to incomplete
type
`varchar_h_remote_vpn_ext_ip'
gmake: *** [ecpg_test.o] Error 1

Compilation exited abnormally with code 2 at Fri Feb 29 09:59:10

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: bug or not bug, xmlvalidate(xml, text) can read and show one line from file
Next
From: Tom Lane
Date:
Subject: Re: BUG: ILIKE with single-byte encoding