From: | wieck(at)debis(dot)com (Jan Wieck) |
---|---|
To: | tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane) |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] Planner drops unreferenced tables --- bug, no? |
Date: | 1999-09-29 14:52:04 |
Message-ID: | m11WL5Q-0003kLC@orion.SAPserv.Hamburg.dsh.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> [...]
>
> Now:
>
> 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".
Caution here!
After rewriting there can be many unused rangetable entries
floating around. Especially if you SELECT from a view, the
view's relation is still mentioned in the rangetable.
If you now build the cartesian product over all relations
(including the EMPTY view relation), you'll allways get NO
rows.
So when touching this, make sure the rewriter removes
properly all rewritten RTE's and those for NEW and OLD.
Removing RTE's will then require changing varno's allover
again. Are you sure you want to open this can of worms?
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#========================================= wieck(at)debis(dot)com (Jan Wieck) #
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1999-09-29 15:04:52 | Re: [HACKERS] Planner drops unreferenced tables --- bug, no? |
Previous Message | Oleg Bartunov | 1999-09-29 14:38:30 | Re: [HACKERS] NULL as an argument in plpgsql functions (fwd) |