Re: [GENERAL] NULL value comparison

2012-08-23 Thread Michael Sacket
On Aug 22, 2012, at 9:38 PM, Craig Ringer wrote: > On 08/23/2012 10:32 AM, Michael Sacket wrote: > >> The good news is I now have the proper constraints in place and the app and >> it's 130 tables are working with PostgreSQL in less than a day. > > Wow, that's cool, especially without SQL chan

Re: [GENERAL] NULL value comparison

2012-08-22 Thread Craig Ringer
On 08/23/2012 10:32 AM, Michael Sacket wrote: The good news is I now have the proper constraints in place and the app and it's 130 tables are working with PostgreSQL in less than a day. Wow, that's cool, especially without SQL changes. What was the previous database? I'm curious now. -- Cra

Re: [GENERAL] NULL value comparison

2012-08-22 Thread Michael Sacket
On Aug 22, 2012, at 8:17 PM, Craig Ringer wrote: > On 08/22/2012 10:58 PM, Michael Sacket wrote: >> Thank you all very much! >> >> Unfortunately I can't change the query... but I can modify the data. I >> updated the NULL values to 'N' and put the appropriate NOT NULL constraint >> and a defa

Re: [GENERAL] NULL value comparison

2012-08-22 Thread Craig Ringer
On 08/22/2012 10:58 PM, Michael Sacket wrote: Thank you all very much! Unfortunately I can't change the query... but I can modify the data. I updated the NULL values to 'N' and put the appropriate NOT NULL constraint and a default value of 'N'. What tool/app is generating the query? They n

Re: [GENERAL] NULL value comparison

2012-08-22 Thread Craig Ringer
On 08/22/2012 09:37 PM, David Johnston wrote: On Aug 22, 2012, at 9:23, Michael Sacket wrote: Good Day, I'm trying to figure out why a postgresql query doesn't return what I'd expect with a query like this where there are NULL values: select * from users where is_enabled<>'Y'; I'm expectin

Re: [GENERAL] NULL value comparison

2012-08-22 Thread Thalis Kalfigkopoulos
Hi Michael. NULL is not any specific value. Thus Pg correctly doesnot tell you that it is <>'Y'. It is NULL means that we dont know the value. Thus it may be 'Y' as much as it may not be 'Y'. The comparison is not applicable in the case of NULL and that's why there are the IS NULL and IS NOT NULL

Re: [GENERAL] NULL value comparison

2012-08-22 Thread Michael Sacket
Thank you all very much! Unfortunately I can't change the query... but I can modify the data. I updated the NULL values to 'N' and put the appropriate NOT NULL constraint and a default value of 'N'. On Aug 22, 2012, at 8:37 AM, David Johnston wrote: > On Aug 22, 2012, at 9:23, Michael Sacket

Re: [GENERAL] NULL value comparison

2012-08-22 Thread David Johnston
On Aug 22, 2012, at 9:23, Michael Sacket wrote: > Good Day, > > I'm trying to figure out why a postgresql query doesn't return what I'd > expect with a query like this where there are NULL values: > > select * from users where is_enabled<>'Y'; > > I'm expecting it to return all records where

Re: [GENERAL] NULL value comparison

2012-08-22 Thread Adrian Klaver
On 08/22/2012 06:23 AM, Michael Sacket wrote: Good Day, I'm trying to figure out why a postgresql query doesn't return what I'd expect with a query like this where there are NULL values: select * from users where is_enabled<>'Y'; I'm expecting it to return all records where is_enabled is 'N'

Re: [GENERAL] NULL value comparison

2012-08-22 Thread Pavel Stehule
2012/8/22 Michael Sacket : > Good Day, > > I'm trying to figure out why a postgresql query doesn't return what I'd > expect with a query like this where there are NULL values: > > select * from users where is_enabled<>'Y'; > > I'm expecting it to return all records where is_enabled is 'N' or NULL.

[GENERAL] NULL value comparison

2012-08-22 Thread Michael Sacket
Good Day, I'm trying to figure out why a postgresql query doesn't return what I'd expect with a query like this where there are NULL values: select * from users where is_enabled<>'Y'; I'm expecting it to return all records where is_enabled is 'N' or NULL. Perhaps my expectations are misguided