Thread: Is this on the to-do list?
From the docs: http://www.postgresql.org/docs/8.3/interactive/sql-update.html "According to the standard, the column-list syntax should allow a list of columns to be assigned from a single row-valued expression, such as a sub-select: UPDATE accounts SET (contact_last_name, contact_first_name) = (SELECT last_name, first_name FROM salesmen WHERE salesmen.id = accounts.sales_id); This is not currently implemented — the source must be a list of independent expressions." Is this feature going into postgresql any day soon? :-)
A B wrote on 18.01.2009 22:43: > From the docs: http://www.postgresql.org/docs/8.3/interactive/sql-update.html > > "According to the standard, the column-list syntax should allow a list > of columns to be assigned from a single row-valued expression, such as > a sub-select: > UPDATE accounts SET (contact_last_name, contact_first_name) = > (SELECT last_name, first_name FROM salesmen > WHERE salesmen.id = accounts.sales_id); > This is not currently implemented — the source must be a list of > independent expressions." > > Is this feature going into postgresql any day soon? :-) > It's on the TODO list: http://wiki.postgresql.org/wiki/Todo#UPDATE
Thomas Kellerer wrote: > A B wrote on 18.01.2009 22:43: > > From the docs: http://www.postgresql.org/docs/8.3/interactive/sql-update.html > > > > "According to the standard, the column-list syntax should allow a list > > of columns to be assigned from a single row-valued expression, such as > > a sub-select: > > UPDATE accounts SET (contact_last_name, contact_first_name) = > > (SELECT last_name, first_name FROM salesmen > > WHERE salesmen.id = accounts.sales_id); > > This is not currently implemented ? the source must be a list of > > independent expressions." > > > > Is this feature going into postgresql any day soon? :-) > > > It's on the TODO list: > > http://wiki.postgresql.org/wiki/Todo#UPDATE Also, I don't know if anyone working on this item for 8.4 or 8.5. -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
On Monday 19 January 2009 18:13:51 Bruce Momjian wrote: > Thomas Kellerer wrote: > > A B wrote on 18.01.2009 22:43: > > > From the docs: > > > http://www.postgresql.org/docs/8.3/interactive/sql-update.html > > > > > > "According to the standard, the column-list syntax should allow a list > > > of columns to be assigned from a single row-valued expression, such as > > > a sub-select: > > > UPDATE accounts SET (contact_last_name, contact_first_name) = > > > (SELECT last_name, first_name FROM salesmen > > > WHERE salesmen.id = accounts.sales_id); > > > This is not currently implemented ? the source must be a list of > > > independent expressions." > > > > > > Is this feature going into postgresql any day soon? :-) > > > > It's on the TODO list: > > > > http://wiki.postgresql.org/wiki/Todo#UPDATE > > Also, I don't know if anyone working on this item for 8.4 or 8.5. > Probably because there is a work-around... UPDATE accounts SET contact_last_name = x.last_name, set contact_first_name = x.first_name FROM (select last_name, first_name from salesmen where salesmen.id = accounts.sales_id) x Which is great if you just want to get this done, but sucks if you wanted the specific syntax from above. -- Robert Treat Conjecture: http://www.xzilla.net Consulting: http://www.omniti.com