Strange result with select/not null/OR

From: "Fernando Papa" <fpapa(at)claxson(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Strange result with select/not null/OR
Date: 2003-06-09 19:48:10
Message-ID: F1DC5B511E2D1C499E5E20FC6D74160D032DA1BB@exch2000.buehuergo.corp.claxson.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi all!

I get a strange result with this query:

SELECT count(*)
FROM CONT_CAT
WHERE id_instal = 2
and id_cat = 2
and (sp_link IS NOT NULL OR sp_link <> '')

I have one row with an empty value ('') on sp_link, so, when I execute
the query expect 0 on the result.
I don't know why the result is 1.
If I only put the last part ("sp_link <> ''") everithing goes ok.
But I need to check both conditions, IF is null and IF is empty. And I
can't understand why doesn't work.

Any ideas?

Thanks in advance!

--
Fernando O. Papa
DBA

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Fitzpatrick 2003-06-09 20:02:12 Pg_dumpall from different versions
Previous Message Sean Chittenden 2003-06-09 18:28:04 Re: Estimate of when CVS will be available again?