Thread: inet problem

inet problem

From
Olivier BLONDEAU
Date:
Hi,
 I'm using the 6.4.2 version of PostgreSQL and I can't find the way to clear a inet field.
 I have a table with 5 inet fields, and I'm unable, when one of them is set  to a value, to make it null.
 So, if someone knows a way to do this, I'm listenig to him ;*)
 Thaks a lot for your help.


Olivier.


Re: [SQL] inet problem

From
"D'Arcy" "J.M." Cain
Date:
Thus spake Olivier BLONDEAU
>   I'm using the 6.4.2 version of PostgreSQL and I can't find the way to clear
>   a inet field.
> 
>   I have a table with 5 inet fields, and I'm unable, when one of them is set 
>   to a value, to make it null.

Can you show how it fails?  It works for me.

darcy=> create table x (i inet);
CREATE
darcy=> insert into x values ('192.168.1.2');
INSERT 63049 1
darcy=> select * from x;         i
-----------
192.168.1.2
(1 row)

darcy=> update x set i = null;
UPDATE 1
darcy=> select * from x;
i
-
(1 row)

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.


Re: [SQL] inet problem

From
Olivier BLONDEAU
Date:
> Can you show how it fails?  It works for me.
> 
> darcy=> update x set i = null;
> UPDATE 1
> darcy=> select * from x;
> i
> -

Ok... It works for me too...

The problem comes from pgaccess who try to make the update like this:

update x set i = 'null';

In this case, ProstgeSQL says he cannot parse "null".

As i thought pgaccess was using the right way, I did the same error in my
php function...

But it works now !

Thanks a lot...


Olivier.