Re: unlogged sequences

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: Tomas Vondra <tomas.vondra@enterprisedb.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-04-03T19:36:25Z
Lists: pgsql-hackers
On 03.04.22 20:50, David G. Johnston wrote:
> However, tables having an identity sequence seem to be unaddressed in 
> this patch.  The existing (and unchanged) pg_dump.c code results in:

It is addressed.  For example, run this in PG14:

create unlogged table t1 (a int generated always as identity, b text);

Then dump it with PG15 with this patch:

CREATE UNLOGGED TABLE public.t1 (
     a integer NOT NULL,
     b text
);


ALTER TABLE public.t1 OWNER TO peter;

--
-- Name: t1_a_seq; Type: SEQUENCE; Schema: public; Owner: peter
--

ALTER TABLE public.t1 ALTER COLUMN a ADD GENERATED ALWAYS AS IDENTITY (
     SEQUENCE NAME public.t1_a_seq
     START WITH 1
     INCREMENT BY 1
     NO MINVALUE
     NO MAXVALUE
     CACHE 1
);
ALTER SEQUENCE public.t1_a_seq SET LOGGED;



Commits

  1. Unlogged sequences

  2. Preparatory test cleanup