| From: | Doug McNaught <doug(at)wireboard(dot)com> |
|---|---|
| To: | Peter Pilsl <pilsl(at)goldfisch(dot)at> |
| Cc: | postgres mailinglist <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: select, where and null-values (or: select null<>'1' is fuzzy) |
| Date: | 2001-06-12 18:20:46 |
| Message-ID: | m3vgm1r24h.fsf@belphigor.mcnaught.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Peter Pilsl <pilsl(at)goldfisch(dot)at> writes:
> I've a problem when selecting values out a table.
>
> manana=# select * from test;
> l1 | l2 | l3
> ----+----+----
> 1 | 2 | 3
> 2 | 3 | 4
> 3 | 4 | 5
> 4 | 5 | 6
> | 5 | 6
> (5 rows)
>
> where l1 is NULL in the last line.
> now I do
>
> manana=# select * from test where l1<>1;
> l1 | l2 | l3
> ----+----+----
> 2 | 3 | 4
> 3 | 4 | 5
> 4 | 5 | 6
> (3 rows)
> and dont get the line with the null-entry !
This has been discussed a lot recently. Basically NULL means
"unknown"; so you can't say it's equal or unequal to any non-NULL
value. The above behavior is in accordance with the SQL standard.
If you tell us what you are trying to do (rather than giving us a toy
example) perhaps we can make some suggestions.
-Doug
--
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time... --Dylan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2001-06-12 18:22:06 | Re: select, where and null-values (or: select null<>'1' is fuzzy) |
| Previous Message | Peter Eisentraut | 2001-06-12 18:20:43 | Re: Format of BOOLEAN |