From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | emre(at)hasegeli(dot)com, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Failed assertion root->hasLateralRTEs on initsplan.c |
Date: | 2014-01-09 13:03:02 |
Message-ID: | CA+TgmoagaMe2WiDL-OR9XULX43aTgPo_ogG_Msmu3Wk_+C7KhQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Jan 7, 2014 at 1:15 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Emre Hasegeli <emre(at)hasegeli(dot)com> writes:
>> I get assertion failure on initsplan.c line 1325 while executing following query
>> on HEAD (edc43458d797a5956f4bf39af18cf62abb0077db). It works fine
>> without --enable-cassert.
>
>> update subscriber set properties = hstore(a) from (select firstname,
>> lastname from player where player.id = subscriber.id) as a;
>
> Hm, AFAICS this query should absolutely *not* work; the reference to
> subscriber.id inside the sub-select is illegal. It might be legal with
> LATERAL, but not otherwise. So I think this is a parser bug, and there's
> nothing wrong with the planner's Assert. 9.2 and earlier throw the
> error I'd expect, so probably something in the LATERAL patches broke
> this case; will look.
>
> The next question is if we should allow it with LATERAL. That would
> essentially be treating "subscriber" as having implicitly appeared at the
> start of the FROM list, which I guess is all right ... but does anyone
> want to argue against it? I seem to recall some old discussions about
> allowing the update target to be explicitly shown in FROM, in case you
> wanted say to left join it against something else. Allowing this implicit
> appearance might limit our options if we ever get around to trying to do
> that. On the other hand, those discussions were a long time back, so
> maybe it'll never happen anyway.
I still think that would be a good thing to do, but I don't see a
problem. The way I imagine it would work is: if the alias used for
the update target also appears in the FROM clause, then we treat them
as the same thing (after checking that they refer to the same table in
both cases). Otherwise, we add the update target as an additional
from-list item.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | MauMau | 2014-01-09 13:12:43 | Re: [bug fix] multibyte messages are displayed incorrectly on the client |
Previous Message | MauMau | 2014-01-09 12:57:42 | Re: Standalone synchronous master |