Re: [PATCH] Implement INSERT SET syntax
От | Tom Lane |
---|---|
Тема | Re: [PATCH] Implement INSERT SET syntax |
Дата | |
Msg-id | 8401.1573840098@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: [PATCH] Implement INSERT SET syntax (Pantelis Theodosiou <ypercube@gmail.com>) |
Список | pgsql-hackers |
Pantelis Theodosiou <ypercube@gmail.com> writes: > On 19/08/2019, at 3:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: >>> Perhaps the way to resolve Peter's objection is to make the syntax >>> more fully like UPDATE: >>> INSERT INTO target SET c1 = x, c2 = y+z, ... FROM >>> tables-providing-x-y-z > Regarding syntax and considering that it makes INSERT look like UPDATE: > there is another difference between INSERT and UPDATE. INSERT allows SELECT > with ORDER BY and OFFSET/LIMIT (or FETCH FIRST), e.g.: ... > But UPDATE doesn't. I suppose the proposed behaviour of INSERT .. SET will > be the same as standard INSERT. So we'll need a note for the differences > between INSERT/SET and UPDATE/SET syntax. I was supposing that this syntax should be just another way to spell INSERT INTO target (columnlist) SELECT ... So everything past FROM would work exactly like it does in SELECT. > On a related not, column aliases can be used in ORDER BY, e.g: As proposed, there's no option equivalent to writing output-column aliases in the INSERT ... SELECT form, so the question doesn't come up. regards, tom lane
В списке pgsql-hackers по дате отправления: