Re: Identity columns, DEFAULT keyword and multi-row inserts

2019-12-11 Thread Peter Eisentraut
On 2019-12-10 17:53, Tom Lane wrote: However, a multi-row insert like the following: insert into test (id, data) values (default,1), (default,2); fails with: ERROR: cannot insert into column "id" Detail: Column "id" is an identity column defined as GENERATED AL

Re: Identity columns, DEFAULT keyword and multi-row inserts

2019-12-10 Thread Tom Lane
Thomas Kellerer writes: > assume the following table: > create table test > ( > id integer not null generated always as identity, > data integer not null > ); > The following insert works fine: > insert into test (id, data) > values (default,1); > However, a mult

Re: Identity columns, DEFAULT keyword and multi-row inserts

2019-12-10 Thread Adrian Klaver
On 12/10/19 12:15 AM, Thomas Kellerer wrote: Patrick FICHE schrieb am 10.12.2019 um 08:56: -Original Message- From: Thomas Kellerer assume the following table: create table test ( id integer not null generated always as identity, data integer not null );

Re: Identity columns, DEFAULT keyword and multi-row inserts

2019-12-10 Thread Thomas Kellerer
Patrick FICHE schrieb am 10.12.2019 um 08:56: >> -Original Message- >> From: Thomas Kellerer >> >> assume the following table: >> >> create table test >> ( >> id integer not null generated always as identity, >> data integer not null >> ); >> >> However, a mu

RE: Identity columns, DEFAULT keyword and multi-row inserts

2019-12-09 Thread Patrick FICHE
Hi Thomas, I agree that it does not seem very consistent. But is there any specific reason why are you using DEFAULT ? Why don't you simply execute : insert into test (data) values (1), (2); If you want / have to specify DEFAULT, then you should probably create your identity