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

Re: Possible to insert quoted null value into integer field?

From: Jeff Boes <jboes(at)qtm(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Possible to insert quoted null value into integer field?
Date: 2004-09-02 14:14:58
Message-ID: DVFZc.92531$JG7.32916@hydra.nntpserver.com (view raw or flat)
Thread:
Lists: pgsql-general
Gaetano Mendola wrote:
> 
>>> And IIRC for oracle an empty string is a NULL value  :-(
>>
>>
>>
>> Who cares about Oracle? They are different things in the ANSI standard.
> 
> 
> :-(
> ^^^
> 

Seems like you could handle this with a rule:

create rule as on insert to my_table
where new.that_column = '' do instead
insert into my_table (col_a, col_b, that_col)
values (new.col_a, new.col_b, NULL);

Or would this break long before the rule got involved, because 
new.that_column has a bad value?

-- 
(Posted from an account used as a SPAM dump. If you really want to get
in touch with me, dump the 'jboes' and substitute 'mur'.)
________
Jeffery Boes <>< jboes(at)qtm(dot)net

In response to

pgsql-general by date

Next:From: Leonardo FrancalanciDate: 2004-09-02 14:16:54
Subject: R: "\d tablename" to get column name, and column type by using JDBC
Previous:From: Tom LaneDate: 2004-09-02 14:11:32
Subject: Re: zombie primary key lurches out of database to devour the brains of the unwary

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