From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, steven(dot)winfield(at)cantabcapital(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #14952: COPY fails to fill in IDENTITY column default value |
Date: | 2018-02-02 20:15:23 |
Message-ID: | bb65c62e-bb90-25a4-c993-b28facf5ff1e@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 2/1/18 20:49, Michael Paquier wrote:
> Wrapping again my mind on this one... On top of the comment for
> identitySequence, I think that it is important to mention that the
> sequence name and a RangeVar are basically safe as they get created
> hence they are not visible to other sessions yet. 0001 and 0002 should
> be merged.
Committed with more comments and as one patch.
> By the way, on HEAD with two sessions it is easy to bump into sequence
> name conflicts with identity columns:
> * Session 1:
> begin;
> create table itest13 (a int);
> * Session 2:
> create sequence itest13_b_seq;
> * Session 1:
> alter table itest13 add columns b int generated by default as identity; --blocks
> * Session 2:
> commit;
>
> And then session 1 reports that:
> ERROR: 23505: duplicate key value violates unique constraint "pg_type_typname_nsp_index"
> DETAIL: Key (typname, typnamespace)=(itest13_b_seq, 2200) already exists.
> SCHEMA NAME: pg_catalog
> TABLE NAME: pg_type
> CONSTRAINT NAME: pg_type_typname_nsp_index
> LOCATION: _bt_check_unique, nbtinsert.c:434
I think this is equivalent to pre-existing behavior with serial:
S1: begin;
S2: begin;
S2: create sequence t1_a_seq;
S1: create table t1 (a serial, b text); --blocks
S2: commit;
S1: ERROR
I suspect you can also construct situations like this with other
implicitly created objects such as triggers.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2018-02-02 21:49:44 | Re: BUG #14912: Undocumented: 'psql -l' assumes database 'postgresql' not $USER |
Previous Message | Michael | 2018-02-02 19:05:45 | Re: crypt function crash on postgresql 9.3.20 and 10 |