Re: Two sequences associated with one identity column

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Two sequences associated with one identity column
Дата
Msg-id e1513246-9b04-4beb-ac8e-16a1c2f1ebd5@aklaver.com
обсуждение исходный текст
Ответ на Re: Two sequences associated with one identity column  ("Colin 't Hart" <colinthart@gmail.com>)
Ответы Re: Two sequences associated with one identity column
Список pgsql-general
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
adrian.klaver@aklaver.com



В списке pgsql-general по дате отправления: