From: | Mike Mascari <mascarm(at)mascari(dot)com> |
---|---|
To: | "Wm(dot) G(dot) Urquhart" <wgu(at)wurquhart(dot)co(dot)uk> |
Cc: | PostgreSQL General Forum <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Violation of NOT NULL |
Date: | 2002-05-23 15:13:56 |
Message-ID: | 3CED0734.F7B6106D@mascari.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Wm. G. Urquhart" wrote:
>
> On Thu, 23 May 2002, Mike Mascari wrote:
>
> <snip/>
> > Also, if by chance you are coming over from Oracle and expect an empty
> > string to be treated as NULL, it is not...
> >
> > Mike Mascari
> > mascarm(at)mascari(dot)com
> >
>
> Well I have a few years of Oracle behind me and it has to said I was
> working on that assumption.
>
> With that said if '' does != NULL then what does? Just NULL? In my book
> NULL means undefined and IMHO you can't get more undefined than ''!
>
> I called my stored function passing NULL as a parameter and sure enough
> the error was raised. So, what I'm going to have to do now is add code to
> either the C++ application or within the script to trap empty $.
>
> Oh well.
You could:
CREATE TABLE foo (
value text CHECK (COALESCE(value, '') <> '')
);
if you want to prohibit both NULL and empty text as data...
Hope that helps,
Mike Mascari
mascarm(at)mascari(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Ed Loehr | 2002-05-23 15:18:07 | "smart-fast" shutdown? |
Previous Message | ktt | 2002-05-23 15:06:00 | pattern search |