Lists: | pgsql-sql |
---|
From: | Don Park <donp+postgresql(at)klickitat(dot)st> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | numeric fields and null |
Date: | 2003-05-22 20:17:57 |
Message-ID: | Pine.LNX.4.51.0305221317360.17969@amidala.klickitat.st |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
Im trying to pull out all records in a table where field
'postaladdressid=null' but I cant figure this out.
\d users
....
id | numeric
postaladdressid | numeric
....
adhoc=# update users set postaladdressid=null where id=50;
UPDATE 1
adhoc=# select id,postaladdressid from users where postaladdressid=null;
id | postaladdressid
----+-----------------
(0 rows)
Why did it not select record 50?
just for your info, this is what record 50 looks like.
adhoc=# select id,postaladdressid from users where id=50;
id | postaladdressid
----+-----------------
50 |
(1 row)
Don
--
** irc: irc.freenode.net nick: don-o channels: #wireless, #java
** As we enjoy great advantages from inventions of others, we should be
** glad of an opportunity to serve others by any invention of ours; and
** this we should do freely and generously. --Benjamin Franklin
From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Don Park <donp+postgresql(at)klickitat(dot)st> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: numeric fields and null |
Date: | 2003-05-22 22:25:56 |
Message-ID: | 20030522152454.P46888-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
On Thu, 22 May 2003, Don Park wrote:
> Im trying to pull out all records in a table where field
> 'postaladdressid=null' but I cant figure this out.
>
> \d users
> ....
> id | numeric
> postaladdressid | numeric
> ....
>
> adhoc=# update users set postaladdressid=null where id=50;
> UPDATE 1
>
> adhoc=# select id,postaladdressid from users where postaladdressid=null;
> id | postaladdressid
> ----+-----------------
> (0 rows)
>
> Why did it not select record 50?
Because NULL=NULL is not true (it's unknown). Use IS NULL if you want to
see if something is NULL.
From: | Guy Fraser <guy(at)incentre(dot)net> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: numeric fields and null |
Date: | 2003-05-22 22:27:03 |
Message-ID: | 3ECD4EB7.1080407@incentre.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
Use:
SELECT id,postaladdressid FROM users WHERE postaladdressid IS NULL;
Don Park wrote:
>Im trying to pull out all records in a table where field
>'postaladdressid=null' but I cant figure this out.
>
>\d users
>....
>id | numeric
>postaladdressid | numeric
>....
>
>adhoc=# update users set postaladdressid=null where id=50;
>UPDATE 1
>
>adhoc=# select id,postaladdressid from users where postaladdressid=null;
> id | postaladdressid
>----+-----------------
>(0 rows)
>
>Why did it not select record 50?
>
>just for your info, this is what record 50 looks like.
>adhoc=# select id,postaladdressid from users where id=50;
> id | postaladdressid
>----+-----------------
> 50 |
>(1 row)
>
>
>Don
>
>
From: | Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar> |
---|---|
To: | Don Park <donp+postgresql(at)klickitat(dot)st>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: numeric fields and null |
Date: | 2003-05-22 22:40:48 |
Message-ID: | 200305221940.49755.franco@akyasociados.com.ar |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
the correct way to do it is
select id,postaladdressid from users where postaladdressid IS null;
I could tell you way, but this explanation (http://techdocs.postgresql.org/guides/BriefGuideToNulls) is
so good that I'would waste your time :)
On Thursday 22 May 2003 17:17, Don Park wrote:
> Im trying to pull out all records in a table where field
> 'postaladdressid=null' but I cant figure this out.
>
> \d users
> ....
> id | numeric
> postaladdressid | numeric
> ....
>
> adhoc=# update users set postaladdressid=null where id=50;
> UPDATE 1
>
> adhoc=# select id,postaladdressid from users where postaladdressid=null;
> id | postaladdressid
> ----+-----------------
> (0 rows)
>
> Why did it not select record 50?
>
> just for your info, this is what record 50 looks like.
> adhoc=# select id,postaladdressid from users where id=50;
> id | postaladdressid
> ----+-----------------
> 50 |
> (1 row)
>
>
> Don
From: | Don Park <donp+postgresql(at)klickitat(dot)st> |
---|---|
To: | Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: numeric fields and null |
Date: | 2003-05-22 23:25:13 |
Message-ID: | Pine.LNX.4.51.0305221624520.25552@amidala.klickitat.st |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
thank you. that sounds like just the info I need.
Don
On Thu, 22 May 2003, Franco Bruno Borghesi wrote:
> the correct way to do it is
> select id,postaladdressid from users where postaladdressid IS null;
>
> I could tell you way, but this explanation (http://techdocs.postgresql.org/guides/BriefGuideToNulls) is
> so good that I'would waste your time :)
>
> On Thursday 22 May 2003 17:17, Don Park wrote:
> > Im trying to pull out all records in a table where field
> > 'postaladdressid=null' but I cant figure this out.
> >
> > \d users
> > ....
> > id | numeric
> > postaladdressid | numeric
> > ....
> >
> > adhoc=# update users set postaladdressid=null where id=50;
> > UPDATE 1
> >
> > adhoc=# select id,postaladdressid from users where postaladdressid=null;
> > id | postaladdressid
> > ----+-----------------
> > (0 rows)
> >
> > Why did it not select record 50?
> >
> > just for your info, this is what record 50 looks like.
> > adhoc=# select id,postaladdressid from users where id=50;
> > id | postaladdressid
> > ----+-----------------
> > 50 |
> > (1 row)
> >
> >
> > Don
>
> [lucifer.akyasociados.com.ar -4m -4s klickitat.st -1m -21s ]
>
--
** irc: irc.freenode.net nick: don-o channels: #wireless, #java
** As we enjoy great advantages from inventions of others, we should be
** glad of an opportunity to serve others by any invention of ours; and
** this we should do freely and generously. --Benjamin Franklin
From: | Alexey Dashevsky <alex(at)kpgaz(dot)chernigov(dot)ua> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: numeric fields and null |
Date: | 2003-05-23 05:51:49 |
Message-ID: | 20030523055146.7929619327@kpgaz.chernigov.ua |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
> > adhoc=# update users set postaladdressid=null where id=50;
> > UPDATE 1
> >
> > adhoc=# select id,postaladdressid from users where postaladdressid=null;
> > id | postaladdressid
> > ----+-----------------
> > (0 rows)
> >
> > Why did it not select record 50?
>
> Because NULL=NULL is not true (it's unknown). Use IS NULL if you want to
> see if something is NULL.
If in postgresql.conf set parameter transform_null_equals=TRUE ????