Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Planner drops unreferenced tables --- bug, no?

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Planner drops unreferenced tables --- bug, no?
Date: 1999-09-29 15:21:58
Message-ID: 3.0.1.32.19990929082158.00a563d0@mail.pacifier.com (view raw or flat)
Thread:
Lists: pgsql-hackers
At 10:34 AM 9/29/99 -0400, Tom Lane wrote:

>play=> select x.f1 from x, x as x2;
>f1
>--
> 1
> 2
> 3
>(3 rows)
>
>It seems to me that the latter query must yield 9 rows (three
>occurrences of each value) to satisfy the SQL spec.  The spec defines
>the result of a two-query FROM clause to be the Cartesian product of the
>two tables, period.  It doesn't say anything about "only if one or more
>columns of each table are actually used somewhere".

AFAIK, this is correct.  For the heck of it, I tried it in 
Oracle, and indeed the full cartesian product's returned:


SQL> select x2.i from x, x x2;

         I
----------
         1
         1
         1
         2
         2
         2
         3
         3
         3

9 rows selected.

>play=> select count(1) from x;
>count
>-----
>    1
>(1 row)

Again, Oracle 8:

SQL> select count(1) from x, x x2;

  COUNT(1)
----------
         9

SQL> 



- Don Baccus, Portland OR <dhogaza(at)pacifier(dot)com>
  Nature photos, on-line guides, Pacific Northwest
  Rare Bird Alert Service and other goodies at
  http://donb.photo.net.

In response to

pgsql-hackers by date

Next:From: Thomas LockhartDate: 1999-09-29 15:30:26
Subject: Re: [HACKERS] string function
Previous:From: Jan WieckDate: 1999-09-29 15:16:18
Subject: Re: [HACKERS] Planner drops unreferenced tables --- bug, no?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group