Re: [HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-05 Thread Merlin Moncure
On Sat, May 3, 2014 at 5:48 AM, Marko Tiikkaja ma...@joh.to wrote: On 5/2/14, 10:10 PM, Merlin Moncure wrote: On Fri, May 2, 2014 at 3:03 PM, Tom Lane t...@sss.pgh.pa.us wrote: Meh. Then you could have a query that works fine until you add a column to the table, and it stops working. If

Re: [HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-05 Thread Pavel Stehule
2014-05-05 17:02 GMT+02:00 Merlin Moncure mmonc...@gmail.com: On Sat, May 3, 2014 at 5:48 AM, Marko Tiikkaja ma...@joh.to wrote: On 5/2/14, 10:10 PM, Merlin Moncure wrote: On Fri, May 2, 2014 at 3:03 PM, Tom Lane t...@sss.pgh.pa.us wrote: Meh. Then you could have a query that works

Re: [HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-05 Thread Andrew Dunstan
On 05/05/2014 11:20 AM, Pavel Stehule wrote: How about: UPDATE foo SET (foo).* = (1,2,3); It is looking little bit strange I like previous proposal UPDATE foo SET foo = (1,2,3); What if the table has a field called foo? Won't it then be ambiguous? cheers andrew -- Sent via

Re: [HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-05 Thread Merlin Moncure
On Mon, May 5, 2014 at 10:32 AM, Andrew Dunstan and...@dunslane.net wrote: On 05/05/2014 11:20 AM, Pavel Stehule wrote: How about: UPDATE foo SET (foo).* = (1,2,3); It is looking little bit strange I like previous proposal UPDATE foo SET foo = (1,2,3); What if the table has

Re: [HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-05 Thread David G Johnston
Merlin Moncure-2 wrote On Sat, May 3, 2014 at 5:48 AM, Marko Tiikkaja lt; marko@ gt; wrote: On 5/2/14, 10:10 PM, Merlin Moncure wrote: On Fri, May 2, 2014 at 3:03 PM, Tom Lane lt; tgl@.pa gt; wrote: Meh. Then you could have a query that works fine until you add a column to the

Re: [HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-03 Thread Marko Tiikkaja
On 5/2/14, 10:10 PM, Merlin Moncure wrote: On Fri, May 2, 2014 at 3:03 PM, Tom Lane t...@sss.pgh.pa.us wrote: Meh. Then you could have a query that works fine until you add a column to the table, and it stops working. If nobody ever used column names identical to table names it'd be all

[HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-02 Thread Tom Lane
I've been thinking about how we might implement the multiple column assignment UPDATE syntax that was introduced in SQL:2003. This feature allows you to do UPDATE table SET ..., (column, column, ...) = row-valued expression, ... where the system arranges to evaluate the row-valued expression

Re: [HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-02 Thread Merlin Moncure
On Fri, May 2, 2014 at 1:15 PM, Tom Lane t...@sss.pgh.pa.us wrote: I've been thinking about how we might implement the multiple column assignment UPDATE syntax that was introduced in SQL:2003. This feature allows you to do UPDATE table SET ..., (column, column, ...) = row-valued expression,

Re: [HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-02 Thread Tom Lane
Merlin Moncure mmonc...@gmail.com writes: On Fri, May 2, 2014 at 1:15 PM, Tom Lane t...@sss.pgh.pa.us wrote: I've been thinking about how we might implement the multiple column assignment UPDATE syntax that was introduced in SQL:2003. This feature allows you to do UPDATE table SET ...,

Re: [HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-02 Thread Merlin Moncure
On Fri, May 2, 2014 at 2:47 PM, Tom Lane t...@sss.pgh.pa.us wrote: Merlin Moncure mmonc...@gmail.com writes: 2) I often wish that you could reference the table (or it's alias) directly as the field list. UPDATE foo f set f = (...)::foo; or even UPDATE foo SET foo = foo; Hm. You could get

Re: [HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-02 Thread Tom Lane
Merlin Moncure mmonc...@gmail.com writes: On Fri, May 2, 2014 at 2:47 PM, Tom Lane t...@sss.pgh.pa.us wrote: But I don't think your suggestions of the table name or alias work; they could conflict with an actual column name. Presumably it'd follow similar rules to SELECT -- resolve the column

Re: [HACKERS] Supporting multiple column assignment in UPDATE (9.5 project)

2014-05-02 Thread Merlin Moncure
On Fri, May 2, 2014 at 3:03 PM, Tom Lane t...@sss.pgh.pa.us wrote: Merlin Moncure mmonc...@gmail.com writes: On Fri, May 2, 2014 at 2:47 PM, Tom Lane t...@sss.pgh.pa.us wrote: But I don't think your suggestions of the table name or alias work; they could conflict with an actual column name.