Re: Switching identity column to serial

2023-02-08 Thread Peter Eisentraut
On 04.02.23 21:55, Erik Wienhold wrote: Why doesn't this work? BEGIN; DROP SEQUENCE t_id; [This won't work, you need to use ALTER TABLE / DROP IDENTITY.] CREATE SEQUENCE new_t_id_seq AS INTEGER OWNED BY t.id; ALTER SEQUENCE new_t_id_seq OWNER TO new_owner; SELECT setval('new_t_id'

Re: Switching identity column to serial

2023-02-04 Thread Erik Wienhold
> On 04/02/2023 05:41 CET Ron wrote: > > On 2/3/23 18:54, Erik Wienhold wrote: > > > I was wondering if it's possible to drop a column identity (not the column > > itself) while keeping the attached sequence. This would avoid recreating > > an identical sequence (especially with a correct start v

Re: Switching identity column to serial

2023-02-03 Thread Ron
On 2/3/23 22:41, Ron wrote: On 2/3/23 18:54, Erik Wienhold wrote: I was wondering if it's possible to drop a column identity (not the column itself) while keeping the attached sequence. This would avoid recreating an identical sequence (especially with a correct start value and owner). Why do

Re: Switching identity column to serial

2023-02-03 Thread Ron
On 2/3/23 18:54, Erik Wienhold wrote: I was wondering if it's possible to drop a column identity (not the column itself) while keeping the attached sequence. This would avoid recreating an identical sequence (especially with a correct start value and owner). Why doesn't this work? BEGIN; DROP

Re: Switching identity column to serial

2023-02-03 Thread Erik Wienhold
> On 04/02/2023 01:54 CET Erik Wienhold wrote: > > I was wondering if it's possible to drop a column identity (not the column > itself) while keeping the attached sequence. This would avoid recreating > an identical sequence (especially with a correct start value and owner). > > Changing the sequ

Switching identity column to serial

2023-02-03 Thread Erik Wienhold
I was wondering if it's possible to drop a column identity (not the column itself) while keeping the attached sequence. This would avoid recreating an identical sequence (especially with a correct start value and owner). Changing the sequence owner to NONE before dropping identity is not allowed.