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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-hackers by date

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