Re: [BUGS] ecpg produces code that won't compile

2008-03-03 Thread Steve Clark

Michael Meskes wrote:

On Sat, Mar 01, 2008 at 04:50:46PM -0300, Euler Taveira de Oliveira wrote:


ecpg_test.pgc:36: error: invalid application of `sizeof' to incomplete type
`varchar_h_tunnel_active'


It seems that are you using implicit cast from varchar to inet. It  
doesn't work in 8.3 anymore. You need to cast before calling the  
function, ie, func(col::inet).

...



However, this doesn't explain why ecpg fails to generate valid C code.

Michael

Hi Michael,

The patch fixed the compile errors.

Thanks,
Steve

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your Subscription:
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.orgextra=pgsql-bugs


Re: [BUGS] ecpg produces code that won't compile

2008-03-02 Thread Michael Meskes
On Sat, Mar 01, 2008 at 04:50:46PM -0300, Euler Taveira de Oliveira wrote:
 ecpg_test.pgc:36: error: invalid application of `sizeof' to incomplete type
 `varchar_h_tunnel_active'

 It seems that are you using implicit cast from varchar to inet. It  
 doesn't work in 8.3 anymore. You need to cast before calling the  
 function, ie, func(col::inet).
 ...

However, this doesn't explain why ecpg fails to generate valid C code.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: [EMAIL PROTECTED]
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!

--
Do not post admin requests to the list. They will be ignored.
pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
Help/Unsubscribe/Update your Subscription:
   
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.orgextra=pgsql-bugs


Re: [BUGS] ecpg produces code that won't compile

2008-03-01 Thread Euler Taveira de Oliveira

Steve Clark wrote:


ecpg_test.pgc:36: error: invalid application of `sizeof' to incomplete type
`varchar_h_tunnel_active'


It seems that are you using implicit cast from varchar to inet. It 
doesn't work in 8.3 anymore. You need to cast before calling the 
function, ie, func(col::inet).


euler=# select '127.0.0.1/32'::varchar = '127.0.0.1/32'::inet;
ERROR:  operator does not exist: character varying = inet
LINHA 1: select '127.0.0.1/32'::varchar = '127.0.0.1/32'::inet;
^
DICA:  No operator matches the given name and argument type(s). You 
might need to add explicit type casts.

euler=# select '127.0.0.1/32'::varchar::inet = '127.0.0.1/32'::inet;
 ?column?
--
 t
(1 registro)


--
  Euler Taveira de Oliveira
  http://www.timbira.com/

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

   http://www.postgresql.org/about/donate


[BUGS] ecpg produces code that won't compile

2008-02-29 Thread Steve Clark

The following bug has been logged online:

Bug reference:  4001
Logged by:  Stephen Clark
Email address:  [EMAIL PROTECTED]
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

---(end of broadcast)---
TIP 6: explain analyze is your friend