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

Re: UPDATE using sub selects

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: NikhilS <nikkhils(at)gmail(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: UPDATE using sub selects
Date: 2008-03-17 22:40:49
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
I wrote:
> ... eg backend/nodes/, optimizer/util/clauses.c, ruleutils.c...)

Actually, on further thought ruleutils.c represents one of the biggest
stumbling blocks here.  We have to be able to reverse-compile the parse
tree into something that's at least semantically equivalent to the
original query.  The existing kluge for UPDATE SET (columns) = ... can
ignore this because it rearranges the query into a sematically
equivalent update with independent SET targets, but the whole problem
with sub-select updates is that there *is* no semantically equivalent
command with a flat targetlist.  So one way or another there will have
to be more information in the parse tree than there is now.

If we use Params that can be traced back to specific SubLink list
entries, it might be okay to finesse this by having ruleutils.c check
for successive targetlist entries that reference outputs of the same
SubLink.  That's pretty ugly but it might be better than changing the
representation of targetlists, which is something that's understood
by one heck of a lot of code.

			regards, tom lane

In response to


pgsql-patches by date

Next:From: Tatsuo IshiiDate: 2008-03-18 01:09:31
Subject: Re: [HACKERS] Proposal: new large object API
Previous:From: Tom LaneDate: 2008-03-17 20:48:25
Subject: Re: UPDATE using sub selects

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