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 < > marko@ > > wrote: >> On 5/2/14, 10:10 PM, Merlin Moncure wrote: >>> >>> On Fri, May 2, 2014 at 3:03 PM, Tom Lane < > tgl@.pa > > wrote: Meh. Then you could have a query that works fine until you add a co

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 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 t

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 p

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 : > On Sat, May 3, 2014 at 5:48 AM, Marko Tiikkaja wrote: > > On 5/2/14, 10:10 PM, Merlin Moncure wrote: > >> > >> On Fri, May 2, 2014 at 3:03 PM, Tom Lane wrote: > >>> > >>> Meh. Then you could have a query that works fine until you add a > column > >>

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 wrote: > On 5/2/14, 10:10 PM, Merlin Moncure wrote: >> >> On Fri, May 2, 2014 at 3:03 PM, Tom Lane 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 co

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 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 right, but unfortunately

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 wrote: > Merlin Moncure writes: >> On Fri, May 2, 2014 at 2:47 PM, Tom Lane 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 SEL

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

2014-05-02 Thread Tom Lane
Merlin Moncure writes: > On Fri, May 2, 2014 at 2:47 PM, Tom Lane 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 > name in the face of ambiguit

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 wrote: > Merlin Moncure 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 there with this syntax

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

2014-05-02 Thread Tom Lane
Merlin Moncure writes: > On Fri, May 2, 2014 at 1:15 PM, Tom Lane wrote: >> I've been thinking about how we might implement the > assignment> UPDATE syntax that was introduced in SQL:2003. This feature >> allows you to do >> UPDATE table SET ..., (column, column, ...) = , ... > Couple quick que

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 wrote: > I've been thinking about how we might implement the assignment> UPDATE syntax that was introduced in SQL:2003. This feature > allows you to do > > UPDATE table SET ..., (column, column, ...) = , ... > > where the system arranges to evaluate the

[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 UPDATE syntax that was introduced in SQL:2003. This feature allows you to do UPDATE table SET ..., (column, column, ...) = , ... where the system arranges to evaluate the just once per row and then assign its fields into the specified target