Обсуждение: Re: [JDBC] select * from mytable where myfield=null;

Поиск
Список
Период
Сортировка

Re: [JDBC] select * from mytable where myfield=null;

От
Jeremy Buchmann
Дата:
Hoanui Morangie wrote:
>   Well Marin, it is a solution but I'm afraid it would bring more
> troubles then benefits. You have dummy values and dummy tupples and have
> to be careful all the time to prevent mess in your data. I prefer using
> NULL value - it's interpretation unambiguous.
>
> Hoanui
>

(This comes from the JDBC list but it's a question for everyone)

So this no longer works in 7.2:

select * from tablename where foo = null;


But what about the isnull operator/keyword/whatever it is...

select * from tablename where foo isnull;

I use that on occasion (in 7.1.2)...did this change in 7.2 also?

--Jeremy



Re: [JDBC] select * from mytable where myfield=null;

От
Andrew Sullivan
Дата:
On Tue, May 14, 2002 at 08:29:06AM -0700, Jeremy Buchmann wrote:
>
> select * from tablename where foo = null;

You can actually turn this back on if you really want --
TRANSFORM_NULL_EQUALS.  See

http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/runtime-config.html#RUNTIME-CONFIG-GENERAL

(watch for long lines -- sorry).  There are good reasons to avoid the
"foo = null" construction, BTW.

> But what about the isnull operator/keyword/whatever it is...
>
> select * from tablename where foo isnull;
>
> I use that on occasion (in 7.1.2)...did this change in 7.2 also?

It works fine.

--
----
Andrew Sullivan                               87 Mowat Avenue
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110