Re: [HACKERS] UPDATE using sub selects

2007-04-11 Thread NikhilS
Hi, Hmm. That sounds like it would be a horrid mess. You need to decouple > the execution of the subplan from the use of its outputs, apparently. > There is some precedent for this in the way that InitPlans are handled: > the result of the subplan is stored into a ParamList array entry that's

Re: [HACKERS] UPDATE using sub selects

2007-03-30 Thread NikhilS
Hi, On 3/31/07, Tom Lane <[EMAIL PROTECTED]> wrote: NikhilS <[EMAIL PROTECTED]> writes: > I have invented a ROWEXPR_SUBLINK type that handles multiple output columns. > The trouble is that since eventually columns of the parents have to be part > of the query's targetList, I am sending the enti

Re: [HACKERS] UPDATE using sub selects

2007-03-30 Thread Tom Lane
NikhilS <[EMAIL PROTECTED]> writes: > I have invented a ROWEXPR_SUBLINK type that handles multiple output columns. > The trouble is that since eventually columns of the parents have to be part > of the query's targetList, I am sending the entire subquery as one of the > entries in that list and the

Re: [HACKERS] UPDATE using sub selects

2007-03-30 Thread NikhilS
Hi, No. Offhand I think you'd either need to relax EXPR_SUBLINK to allow > multiple output columns, or invent a ROW_SUBLINK SubLinkType that is > just like EXPR_SUBLINK except for allowing multiple output columns. > The latter would probably be less likely to break other things... > Yeah, was l

Re: [HACKERS] UPDATE using sub selects

2007-03-16 Thread NikhilS
Hi, On 3/16/07, Tom Lane <[EMAIL PROTECTED]> wrote: NikhilS <[EMAIL PROTECTED]> writes: > To allow both of the above to hold, I think the subselect will have to be > treated like a EXPR_SUBLINK subquery. I was wondering if we have a similar > mechanism for plain selects/subselects to check and

Re: [HACKERS] UPDATE using sub selects

2007-03-16 Thread Tom Lane
NikhilS <[EMAIL PROTECTED]> writes: > To allow both of the above to hold, I think the subselect will have to be > treated like a EXPR_SUBLINK subquery. I was wondering if we have a similar > mechanism for plain selects/subselects to check and restrict their output to > a single row. No. Offhand I

Re: [HACKERS] UPDATE using sub selects

2007-03-15 Thread NikhilS
Hi, > What's the expected result if the tuple from subselect is more than 1? Error, per SQL99 section 7.14: 1) If the cardinality of a is greater than 1 (one), then an exception condition is raised: cardinality violation. I expect no update at all in case of void resu

Re: [HACKERS] UPDATE using sub selects

2007-03-15 Thread Tom Lane
Gaetano Mendola <[EMAIL PROTECTED]> writes: > NikhilS wrote: >> I have tried some update-subselect variations and they seem to work. For >> example the case in the src/test/regress/sql/update.sql, which used to >> fail till now, seems to work: >> >> UPDATE update_test SET (a,b) = (select a,b FROM

Re: [HACKERS] UPDATE using sub selects

2007-03-15 Thread Gaetano Mendola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 NikhilS wrote: > I have tried some update-subselect variations and they seem to work. For > example the case in the src/test/regress/sql/update.sql, which used to > fail till now, seems to work: > > UPDATE update_test SET (a,b) = (select a,b FROM upd

Re: [HACKERS] UPDATE using sub selects

2007-03-14 Thread NikhilS
Hi, > The question is that since this enhances the UPDATE syntax, what changes and > where all they need to be made with respect to the documentation? Documentation is the very least of your worries. What exactly is your implementation plan? If this were a simple or narrow fix it would have

Re: [HACKERS] UPDATE using sub selects

2007-03-14 Thread Tom Lane
NikhilS <[EMAIL PROTECTED]> writes: > I have coded up a patch which solves the following TODO. I will submit a > patch for this soon: > http://archives.postgresql.org/pgsql-hackers/2006-07/msg01306.php Cool... > The question is that since this enhances the UPDATE syntax, what changes and >

[HACKERS] UPDATE using sub selects

2007-03-14 Thread NikhilS
Hi, I have coded up a patch which solves the following TODO. I will submit a patch for this soon: - UPDATE - Allow UPDATE tab SET ROW (col, ...) = (SELECT...) http://archives.postgresql.org/pgsql-hackers/2006-07/msg01306.php The question is that since this enhances the UPDATE sy