Re: Cannot properly initialize inet type fields in the table

Lists: pgsql-hackers
From: fimarn <fimarn(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Cannot properly initialize inet type fields in the table
Date: 2007-09-26 13:55:37
Message-ID: 1190814937.645410.227250@n39g2000hsh.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I have a CREATE TABLE statement where I am trying to initialize
several inet fields, e.g.

CREATE TABLE myConfigTable
(
telnet bool DEFAULT
FALSE,
ftp bool DEFAULT
FALSE,
ipForwarding bool DEFAULT
FALSE,
configIntControlNetw inet DEFAULT
'1.1.0.0',
configIntControlMask inet DEFAULT '255.255.0.0'
);

When I try to execute an INSERT statement associated with this table I
am getting:

NOTICE: failed to convert IP address string, invalid inetstruct len
NOTICE: failed to convert IP address string, invalid inetstruct len

for each initialized inet field.

Does anyone know how to fix this problem? This code used to work under
psql version 7.2.1, but I am trying to make it work under 8.1.4.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: fimarn <fimarn(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Cannot properly initialize inet type fields in the table
Date: 2007-09-26 14:54:43
Message-ID: 21112.1190818483@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

fimarn <fimarn(at)gmail(dot)com> writes:
> When I try to execute an INSERT statement associated with this table I
> am getting:

> NOTICE: failed to convert IP address string, invalid inetstruct len

Your example works fine for me:

regression=# insert into myConfigTable default values;
INSERT 0 1
regression=# select * from myConfigTable;
telnet | ftp | ipforwarding | configintcontrolnetw | configintcontrolmask
--------+-----+--------------+----------------------+----------------------
f | f | f | 1.1.0.0 | 255.255.0.0
(1 row)

and I can find no trace of any such message in either CVS HEAD or 8.1.
Are you running a custom-modified backend?

regards, tom lane