public inbox for [email protected]
help / color / mirror / Atom feedFrom: Colin 't Hart <[email protected]>
To: Adrian Klaver <[email protected]>
Cc: PostgreSQL General <[email protected]>
Subject: Re: Two sequences associated with one identity column
Date: Thu, 30 Oct 2025 09:55:12 +0100
Message-ID: <CAMon-aQNPQ86-swjmpiryy3s_yKaWsZbzysrbn7e1xPc3JM3fg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAMon-aTbZC5k2pLpijk5x+h__LV08DzpoJtHBgZGkOKJNJ91pw@mail.gmail.com>
<[email protected]>
<CAMon-aTMgbwC9j-wY8iX5kZ4=KXzCXc-Wpwx3viid8hQ_bJkoQ@mail.gmail.com>
<[email protected]>
<CAMon-aQ0Zs-Otkp1=zk3WYt7Am-_oQHKEmD_rZ1CNGBAgM_jzw@mail.gmail.com>
<[email protected]>
relname | relnamespace | relpersistence
--------------------------+--------------+----------------
<sequence1> | 524799410 | p
<sequence2> | 524799410 | p
(2 rows)
On Wed, 29 Oct 2025 at 17:28, Adrian Klaver <[email protected]> wrote:
>
> On 10/29/25 06:40, Colin 't Hart wrote:
> > As expected the dump contains:
> >
> > CREATE TABLE <schema>.<tablename> (
> > <other columns>,
> > id bigint NOT NULL
> > );
> >
> > <snip>
> >
> > --
> > -- Name: <sequence1>; Type: SEQUENCE; Schema: <schema>; Owner: <owner>
> > --
> >
> > ALTER TABLE <schema>.<tablename> ALTER COLUMN id ADD GENERATED ALWAYS
> > AS IDENTITY (
> > SEQUENCE NAME <schema>.<sequence1>
> > START WITH 1
> > INCREMENT BY 1
> > NO MINVALUE
> > NO MAXVALUE
> > CACHE 1
> > );
> >
> >
> > --
> > -- Name: <sequence2>; Type: SEQUENCE; Schema: <schema>; Owner: <owner>
> > --
> >
> > ALTER TABLE <schema>.<tablename> ALTER COLUMN id ADD GENERATED ALWAYS
> > AS IDENTITY (
> > SEQUENCE NAME <schema>.<sequence2>
> > START WITH 1
> > INCREMENT BY 1
> > NO MINVALUE
> > NO MAXVALUE
> > CACHE 1
> > );
>
> Just a wild guess. Assuming <schema> is the same, what is the output of:
>
> SELECT
> relname,
> relnamespace,
> relpersistence
> FROM
> pg_class
> WHERE
> relname IN ('<sequence1>', '<sequence2> ')
> AND relnamespace = '<schema>'::regnamespace;
>
>
> >
>
> > /Colin
> >
>
> --
> Adrian Klaver
> [email protected]
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Two sequences associated with one identity column
In-Reply-To: <CAMon-aQNPQ86-swjmpiryy3s_yKaWsZbzysrbn7e1xPc3JM3fg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox