Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sP65c-002raO-Hn for pgsql-general@arkaria.postgresql.org; Wed, 03 Jul 2024 19:56:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sP65a-00BouH-5m for pgsql-general@arkaria.postgresql.org; Wed, 03 Jul 2024 19:56:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sP65Z-00Bou6-Qh for pgsql-general@lists.postgresql.org; Wed, 03 Jul 2024 19:56:26 +0000 Received: from smtp98.iad3b.emailsrvr.com ([146.20.161.98]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sP65Y-000Fce-2w for pgsql-general@lists.postgresql.org; Wed, 03 Jul 2024 19:56:25 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp13.relay.iad3b.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 28F05603F9 for ; Wed, 3 Jul 2024 15:56:23 -0400 (EDT) From: Christophe Pettus Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Can't dump new-style sequences independently from their tables. Message-Id: Date: Wed, 3 Jul 2024 12:55:52 -0700 To: "pgsql-generallists.postgresql.org" X-Mailer: Apple Mail (2.3774.600.62) X-Classification-ID: 87e16988-ede8-4826-9bbe-3dd084df01de-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Quick example: xof=3D# CREATE TABLE t1 (id SERIAL PRIMARY KEY); CREATE TABLE xof=3D# CREATE TABLE t2 (id INTEGER PRIMARY KEY GENERATED ALWAYS AS = IDENTITY); CREATE TABLE xof=3D# \d+ List of relations Schema | Name | Type | Owner | Persistence | Access method | = Size | Description=20 = --------+-----------+----------+-------+-------------+---------------+----= --------+------------- public | t1 | table | xof | permanent | heap | 0 = bytes |=20 public | t1_id_seq | sequence | xof | permanent | | = 8192 bytes |=20 public | t2 | table | xof | permanent | heap | 0 = bytes |=20 public | t2_id_seq | sequence | xof | permanent | | = 8192 bytes |=20 (4 rows) Swift:~ xof$ pg_dump -t 't1_id_seq' | fgrep 'setval' SELECT pg_catalog.setval('public.t1_id_seq', 1, false); Swift:~ xof$ pg_dump -t 't2_id_seq' | fgrep 'setval' Swift:~ xof$ pg_dump -t 't2' | fgrep 'setval' SELECT pg_catalog.setval('public.t2_id_seq', 1, false); Swift:~ xof$=20 So, you can dump a sequence created with SERIAL independently from the = table it is owned by, but not a sequence created by GENERATED ALWAYS AS = IDENTITY; you need to dump the owning table. It's easily worked around, = but I'm curious why that is.=