Re: [HACKERS] about NULL

From: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>
To: shridhar_daithankar(at)persistent(dot)co(dot)in, zhangyue <postgresql(at)db(dot)pku(dot)edu(dot)cn>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] about NULL
Date: 2003-05-21 18:08:29
Message-ID: 200305212008.29122.darko.prenosil@finteh.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wednesday 21 May 2003 10:46, Shridhar Daithankar wrote:
> On 21 May 2003 at 16:10, zhangyue wrote:
> > Hi,
> > How can I get the tuples one of whose attributes is NULL?
> > For example,
> > First, create table tb(id int,name text);
> > Then insert into tb values(1);
> > insert into tb values(2,'Rose');
> > I want to select the tuples whose attribute name= NULL,
> > How to write the sql ?
>
> select columns from table where attribute is null;
>
> This should have been on postgresql-general, not on hackers..
>

SELECT * FROM tb WHERE name IS NULL;
or even
SELECT * FROM tb WHERE name=NULL;
but the second one would work only if "transform_null_equals" is set to true
in postgresql.conf

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Darko Prenosil 2003-05-21 18:10:46 Re: caching query results
Previous Message Bruno Wolff III 2003-05-21 17:39:33 Re: PRIMARY KEYS

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2003-05-21 18:40:17 Re: Removing width from EXPLAIN
Previous Message Tom Lane 2003-05-21 17:40:02 Re: Heads up: 7.3.3 this Wednesday