Re: SET syntax in INSERT - Mailing list pgsql-hackers

From Tom Lane
Subject Re: SET syntax in INSERT
Date
Msg-id 14734.1452802025@sss.pgh.pa.us
Whole thread Raw
In response to Re: SET syntax in INSERT  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
Responses Re: SET syntax in INSERT  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: SET syntax in INSERT  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
List pgsql-hackers
Vitaly Burovoy <vitaly.burovoy@gmail.com> writes:
> On 1/14/16, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> It's more than syntactic sugar; you are going to have to invent semantics,
>> as well, because it's less than clear what partial-field assignments
>> should do.
>> 
>> Assume a table with an int-array column, and consider
>> INSERT INTO foo SET arraycol[2] = 7, arraycol[4] = 11;

> Right part is a column name, not an expression. Isn't it?

UPDATE takes this just fine.  The difference is that in UPDATE there's
no question what the starting value of the column is.

> You can't now do something like
> INSERT INTO foo (arraycol[2], arraycol[4]) VALUES(7, 11);

Hm ... actually, you might want to try that before opining.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Marko Tiikkaja
Date:
Subject: Re: SET syntax in INSERT
Next
From: Andrew Dunstan
Date:
Subject: Re: SET syntax in INSERT