Re: How to select rows with values set to NULL

From: Jani Averbach <jaa(at)cc(dot)jyu(dot)fi>
To: "Tille, Andreas" <TilleA(at)rki(dot)de>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to select rows with values set to NULL
Date: 2002-05-23 09:05:25
Message-ID: Pine.GSO.4.33.0205231202460.377-100000@tukki.cc.jyu.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 23 May 2002, Tille, Andreas wrote:

Seems to work here:

jaa=# create table test2(id int, txt varchar(17) default NULL);
CREATE

jaa=# insert into test2 values(1);
INSERT 420453 1

jaa=# select * from test2 where txt = null;
id | txt
----+-----
1 |
(1 row)

psql (PostgreSQL) 7.1.2

BR, Jani

>
> Hello,
>
> InfluenzaWeb=# create table test (
> InfluenzaWeb(# id int,
> InfluenzaWeb(# txt varchar(17) default NULL);
> CREATE
> InfluenzaWeb=# insert into test values( 1 );
> INSERT 553756 1
> InfluenzaWeb=# select * from test;
> id | txt
> ----+-----
> 1 |
> (1 row)
>
> InfluenzaWeb=# select * from test where txt = NULL;
> id | txt
> ----+-----
> (0 rows)
>
> InfluenzaWeb=# insert into test values(2,'text');
> INSERT 553757 1
> InfluenzaWeb=# select * from test where txt like '%';
> id | txt
> ----+------
> 2 | text
> (1 row)
>
> InfluenzaWeb=# select * from test where not txt like '%';
> id | txt
> ----+-----
> (0 rows)
>
> So how to get all rows which txt has the value NULL?
>
> Kind regards
>
> Andreas.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Jani Averbach

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sander Steffann 2002-05-23 09:27:54 Re: How to select rows with values set to NULL
Previous Message Wm. G. Urquhart 2002-05-23 08:58:59 Addendum to Violation of NOT NULL