Lists: | pgsql-sql |
---|
From: | "Shavonne Marietta Wijesinghe" <shavonne(dot)marietta(at)studioform(dot)it> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | |
Date: | 2005-10-13 15:31:48 |
Message-ID: | 00cc01c5d00b$3a67dc70$1102a8c0@dream |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
how can i do a query with 2 databases??
From: | Scott Marlowe <smarlowe(at)g2switchworks(dot)com> |
---|---|
To: | Shavonne Marietta Wijesinghe <shavonne(dot)marietta(at)studioform(dot)it> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: |
Date: | 2005-10-19 00:30:03 |
Message-ID: | 1129681803.15546.21.camel@state.g2switchworks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
On Thu, 2005-10-13 at 10:31, Shavonne Marietta Wijesinghe wrote:
> how can i do a query with 2 databases??
This is only supported by an add on called dblink, and it's a little bit
klunky.
Could schemas solve your problem?
From: | Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | NULL in IN clause |
Date: | 2005-10-19 20:17:34 |
Message-ID: | 001a01c5d4ea$243a1830$6400a8c0@OTTO |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
Hi,
I have just run this command on 8.0.4 :
SELECT 'foo' WHERE 0 NOT IN (NULL, 1);
And it resulted is zero rows.
Without NULL it is OK.
Is this a bug, or the standard has such a rule?
Best Regards,
Otto
From: | Terry Fielder <terry(at)ashtonwoodshomes(dot)com> |
---|---|
To: | Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: NULL in IN clause |
Date: | 2005-10-19 20:41:48 |
Message-ID: | 4356AF8C.80709@ashtonwoodshomes.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
Havasvölgyi Ottó wrote:
> Hi,
>
> I have just run this command on 8.0.4 :
>
> SELECT 'foo' WHERE 0 NOT IN (NULL, 1);
0 <> NULL (Indeed nothing equals NULL, other then sometimes NULL itself)
0 <> 1
Therefore, the statement: 0 NOT IN (NULL, 1)
Should always equate to false.
Therefore No rows returned. Ever.
Terry
>
> And it resulted is zero rows.
> Without NULL it is OK.
> Is this a bug, or the standard has such a rule?
>
> Best Regards,
> Otto
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>
--
Terry Fielder
terry(at)greatgulfhomes(dot)com
Associate Director Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
Fax: (416) 441-9085
From: | David Dick <david_dick(at)iprimus(dot)com(dot)au> |
---|---|
To: | Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: NULL in IN clause |
Date: | 2005-10-19 20:43:56 |
Message-ID: | 4356B00C.2040702@iprimus.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
As i understand it, the use of NULL in SQL means the value of the column
is unknown. Therefore that result would seem fair.
Havasvölgyi Ottó wrote:
> Hi,
>
> I have just run this command on 8.0.4 :
>
> SELECT 'foo' WHERE 0 NOT IN (NULL, 1);
>
> And it resulted is zero rows.
> Without NULL it is OK.
> Is this a bug, or the standard has such a rule?
>
> Best Regards,
> Otto
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>
From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: NULL in IN clause |
Date: | 2005-10-19 21:00:03 |
Message-ID: | 20051019135459.D99528@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
On Wed, 19 Oct 2005, [iso-8859-2] Havasvlgyi Ott wrote:
> Hi,
>
> I have just run this command on 8.0.4 :
>
> SELECT 'foo' WHERE 0 NOT IN (NULL, 1);
>
> And it resulted is zero rows.
> Without NULL it is OK.
> Is this a bug, or the standard has such a rule?
This is standard behavior.
Seeing if I can do this from memory...
a NOT IN b is equivalent in the spec to NOT(a IN b). a IN b is equivalent
to a =ANY b. a =ANY b returns true if a = x is true for any x in b. a =ANY
b returns false if a = x is false for all x in b. Otherwise it returns
unknown.
0 = NULL returns unknown
0 = 1 returns false
So, 0 IN (NULL,1) returns unknown.
NOT(unknown) is unknown.
WHERE clauses only return rows for which the search condition is true, so
a row is not returned.
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: NULL in IN clause |
Date: | 2005-10-19 21:11:30 |
Message-ID: | 26534.1129756290@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-sql |
=?iso-8859-2?Q?Havasv=F6lgyi_Ott=F3?= <h(dot)otto(at)freemail(dot)hu> writes:
> I have just run this command on 8.0.4 :
> SELECT 'foo' WHERE 0 NOT IN (NULL, 1);
> And it resulted is zero rows.
> Without NULL it is OK.
> Is this a bug, or the standard has such a rule?
This is per spec.
The computation is effectively
NOT (0 = NULL OR 0 = 1)
NOT (NULL OR FALSE)
NOT NULL
NULL
ie, the result is UNKNOWN, which WHERE treats the same as FALSE.
regards, tom lane