pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feednumeric fields and null
8+ messages / 7 participants
[nested] [flat]
* numeric fields and null
@ 2003-05-22 18:40 Don Park <don+postgresql@klickitat.st>
0 siblings, 1 reply; 8+ messages in thread
From: Don Park @ 2003-05-22 18:40 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 8+ messages in thread
* numeric fields and null
@ 2003-05-22 20:17 Don Park <donp+postgresql@klickitat.st>
0 siblings, 3 replies; 8+ messages in thread
From: Don Park @ 2003-05-22 20:17 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: numeric fields and null
@ 2003-05-22 22:25 Stephan Szabo <sszabo@megazone23.bigpanda.com>
parent: Don Park <donp+postgresql@klickitat.st>
2 siblings, 1 reply; 8+ messages in thread
From: Stephan Szabo @ 2003-05-22 22:25 UTC (permalink / raw)
To: Don Park <donp+postgresql@klickitat.st>; +Cc: 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.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: numeric fields and null
@ 2003-05-22 22:27 Guy Fraser <guy@incentre.net>
parent: Don Park <donp+postgresql@klickitat.st>
2 siblings, 0 replies; 8+ messages in thread
From: Guy Fraser @ 2003-05-22 22:27 UTC (permalink / raw)
To: 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
>
>
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: numeric fields and null
@ 2003-05-22 22:40 Franco Bruno Borghesi <franco@akyasociados.com.ar>
parent: Don Park <donp+postgresql@klickitat.st>
2 siblings, 1 reply; 8+ messages in thread
From: Franco Bruno Borghesi @ 2003-05-22 22:40 UTC (permalink / raw)
To: Don Park <donp+postgresql@klickitat.st>; 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
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: numeric fields and null
@ 2003-05-22 23:25 Don Park <donp+postgresql@klickitat.st>
parent: Franco Bruno Borghesi <franco@akyasociados.com.ar>
0 siblings, 0 replies; 8+ messages in thread
From: Don Park @ 2003-05-22 23:25 UTC (permalink / raw)
To: Franco Bruno Borghesi <franco@akyasociados.com.ar>; +Cc: 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
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: numeric fields and null
@ 2003-05-23 00:32 Rod Taylor <rbt@rbt.ca>
parent: Don Park <don+postgresql@klickitat.st>
0 siblings, 0 replies; 8+ messages in thread
From: Rod Taylor @ 2003-05-23 00:32 UTC (permalink / raw)
To: Don Park <don+postgresql@klickitat.st>; +Cc: pgsql-sql
> adhoc=# select id,postaladdressid from users where postaladdressid=null;
Given the SQL definition of NULL, = NULL must be false.
Use postaladdressid IS NULL to do what you want.
--
Rod Taylor <rbt@rbt.ca>
PGP Key: http://www.rbt.ca/rbtpub.asc
Attachments:
signature.asc (application/pgp-signature, 186B) download
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: numeric fields and null
@ 2003-05-23 05:51 Alexey Dashevsky <alex@kpgaz.chernigov.ua>
parent: Stephan Szabo <sszabo@megazone23.bigpanda.com>
0 siblings, 0 replies; 8+ messages in thread
From: Alexey Dashevsky @ 2003-05-23 05:51 UTC (permalink / raw)
To: 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 ????
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2003-05-23 05:51 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-05-22 18:40 numeric fields and null Don Park <don+postgresql@klickitat.st>
2003-05-23 00:32 ` Rod Taylor <rbt@rbt.ca>
2003-05-22 20:17 numeric fields and null Don Park <donp+postgresql@klickitat.st>
2003-05-22 22:25 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2003-05-23 05:51 ` Alexey Dashevsky <alex@kpgaz.chernigov.ua>
2003-05-22 22:27 ` Guy Fraser <guy@incentre.net>
2003-05-22 22:40 ` Franco Bruno Borghesi <franco@akyasociados.com.ar>
2003-05-22 23:25 ` Don Park <donp+postgresql@klickitat.st>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox