Re: Null in the where-clause

From: Gregory Seidman <gss+pgsql(at)cs(dot)brown(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Null in the where-clause
Date: 2002-07-08 21:33:40
Message-ID: 20020708213340.GA6917@cs.brown.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Walzl sez:
} Hello everybody,
}
} I've got a problem with the "null"-statement within the where-clause.
} I installed the postgres-server 7.2.1 on a Suse Linux machine.
} Then I imported an existing databasedump.
} But when I make the following query:
} select * from tbl_categories where categoryid=null;
} I get 0 rows as result, but there are several records, which
} corrsponds to my query.
} What could be the problem? Do I have to reinstall the server
} with a special parameter?

The problem is that null isn't equal to anything, including itself. While a
null value in a column is not equal to null, it IS NULL:

select * from tbl_categories where categoryid is null;

} Thanx in advance
} Michael Walzl
--Greg

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Busby 2002-07-08 21:40:47 Returning bytea* from a C function
Previous Message Joshua D. Drake 2002-07-08 21:26:29 Re: PostgreSQL vs Postgres