Re: SET syntax in INSERT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Marko Tiikkaja <marko(at)joh(dot)to>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SET syntax in INSERT
Date: 2016-01-14 20:07:05
Message-ID: 14734.1452802025@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com> writes:
> On 1/14/16, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2016-01-14 20:14:58 Re: SET syntax in INSERT
Previous Message Marko Tiikkaja 2016-01-14 20:00:27 Re: SET syntax in INSERT