Re: Possible to insert quoted null value into integer field? - Mailing list pgsql-general

From Jeff Boes
Subject Re: Possible to insert quoted null value into integer field?
Date
Msg-id DVFZc.92531$JG7.32916@hydra.nntpserver.com
Whole thread Raw
In response to Re: Possible to insert quoted null value into integer field?  (Gaetano Mendola <mendola@bigfoot.com>)
List 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@qtm.net

pgsql-general by date:

Previous
From: Jeff Boes
Date:
Subject: Re: Join efficiency
Next
From: Daniel Martini
Date:
Subject: Re: The future of built-in geometric data types