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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-general by date

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