From depesz@depesz.com Fri May 15 23:22:48 2026 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 1vE4tK-004MPd-46 for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 12:03:01 +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 1vE4tI-000Wg6-UD for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 12:02:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vE4tI-000Wfy-JX for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 12:02:59 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vE4tF-004sa2-1a for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 12:02:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description; bh=/xJKUFjnhorpF6VYPwIKnZ/dtNyKnmKkYBODisnuVvQ=; b=Kk7tyF53IXnF/IIPNJVNNjrRDK GVVnXaYWn9e1QU8pBxg+ohdhzQn25NWr+mE8dvUfGsvTdJu67bGPKcPcvPcV5Ssmj3R/3cFZpAJ72 4YtJOvwCrGkMem+J13WCx7KoOPeshGah90f8OcuWgErujmWZapSfL0EBjgqI/IXjRAXk=; Received: from depesz by depesz.com with local (Exim 4.96) (envelope-from ) id 1vE4tE-0032Gc-0K; Wed, 29 Oct 2025 13:02:56 +0100 Date: Wed, 29 Oct 2025 13:02:56 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Colin 't Hart Cc: pgsql-general@lists.postgresql.org Subject: Re: Two sequences associated with one identity column Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Oct 29, 2025 at 12:27:44PM +0100, Colin 't Hart wrote: > One of my clients has a database in which a single identity column > (called "id" in that table) has two sequences associated with it(!) > Both sequences display > Sequence for identity column: ..id > when described with \d in psql. > Trying to drop either sequence results in Try: ALTER SEQUENCE some_seq_name OWNED BY none; DROP SEQUENCE some_seq_name; Best regards, depesz From colinthart@gmail.com Fri May 15 23:23:16 2026 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 1vE4w2-004N7U-FG for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 12:05:49 +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 1vE4w1-000bdG-Cu for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 12:05:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vE4w1-000bd8-2A for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 12:05:48 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vE4vx-004sdU-2x for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 12:05:47 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-290cd62acc3so79824235ad.2 for ; Wed, 29 Oct 2025 05:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761739543; x=1762344343; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=4f+y+d2mmK4YcC6HtKw0DNUfahoh/8eesKxyjznBcjc=; b=aEKbYrwFYr8ay+AL1f0KwnAkMavvjrebuQSMtx6jwZiQxWscC/SuIikfIjRB9kopjw 59+F872NwQj5P4qlW2SGv9GRzUIjcWLVF1ev6rbS3SAEaoYi8nUkAMuEQ1y28x64aPYF vTdXZtPYx2EUaaWRILvK51/DyaTTQ2b5R5rtkouObGsJW8dH7XOixLOSnd1ZyL+lNLb4 5yv4KVg4G/YIPl74VijUrU8SyfXk+k+DNAeEZLb2yPNhtV/k1//XmCk1fvGSV4x/pOl8 IyodinRRBilJ504ywXTT+BouIHahg4BIbnDccWDWp/1twbZYdTM9d+aVTvfeMPQD3yMA xvaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761739543; x=1762344343; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4f+y+d2mmK4YcC6HtKw0DNUfahoh/8eesKxyjznBcjc=; b=lPqOyPkBBnK0JjwdTXkVPMZdeg+XwYgkwB2ALgnJx059JtNBph8fV56/TpJsVYU1gF S9FMDqgnTq/Ov9lUYGU4+eZIsSbxfM00k9HT6H5YxLQ5h4cdraHTOotkI3JMaQlBNiRv qjeOCsORCWtEK+zeYr+f8QEUj9n32m17qGcSBexwDfRq8t2RvkfNNbq6OSu626B0q7x6 YEh+Ul1ixPKGIVAWyJVfISKuT37gMEtFb0gV+0sFccdzKElFdB8GJm2ImPVwT7y+86vP /HByWRhz3OYzZ90luKWO+B5etnWT9PYebKhsTyPYXy2iNKPtXmdH0bzyNMgqjVlpQAtk iMgg== X-Gm-Message-State: AOJu0YwOE2KyksMwmV4t+ljWNg13vK4boSBLl/1zk/TBkbKQYTyvvqM6 HEEhUvIlZrY3gMVfwHI0tFs2X7ioeTGAQYczpg5Wti3kKreBV/gRlmlCMyBmwuGvgVH67spO9nL v9lZ/Eh0ipMtEAIMwDTyTYZc3FIzq35+cELfQ X-Gm-Gg: ASbGncsicCf9+emJYio0wy3GPlOss0XvGCrRMHZ0VvM6ZL3SOeGBLNV/pN7ZPWqW4b1 ghqp1DO/9FLfyI+Ppuz4QLy7Lp8eLZZSdRToHUHsaX5sA06+hHtDO94TmOS8DgzJDL9VNavpdlN gpp0JcLtP4xmedj7iO5qUYsZn/8s9wgdohjXY00f5vFV3Cqkb+B3Mp6ca+FtueYfVP027drONOR EO2t2hgVrI23U1UHS1NDao8/7dB9r6uVYKsLdL7Kf9gaw/ay7HZrZvjFBdGwZYOHyP/+V3RsqEm HLWtA/3R+Gow6T6JPaK/xpHVj/HpYgvCFHAsixNFSOMhRUUdxosYNyLOztfhnGHiyN1P0G+rIAQ 5LizZ6gLL21hWyMMp0bC9dKYN75WWueKOhPk1bFHqZoULTaGxOLffyb1zoMGo X-Google-Smtp-Source: AGHT+IHm6ThouZT5TrL7RcSZIatBESN/YAZNYRETGJuiWsjDFhRTq4JyzyZAEkGllqxFwwquVMM2Enak5zdCU7XKxYk= X-Received: by 2002:a17:902:e74c:b0:293:623:3246 with SMTP id d9443c01a7336-294dee2db5emr33710375ad.13.1761739542566; Wed, 29 Oct 2025 05:05:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Colin 't Hart" Date: Wed, 29 Oct 2025 13:05:30 +0100 X-Gm-Features: AWmQ_blka7eVd7WNsctcRwiqmXXnxt0oPmjKiDX1zFAN45f8eN41p4bQhFZIjlE Message-ID: Subject: Re: Two sequences associated with one identity column To: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thanks. But as I wrote above, trying to alter either of the two sequences and specifying "owned by none" results in the error. /Colin On Wed, 29 Oct 2025 at 13:02, hubert depesz lubaczewski wrote: > > On Wed, Oct 29, 2025 at 12:27:44PM +0100, Colin 't Hart wrote: > > One of my clients has a database in which a single identity column > > (called "id" in that table) has two sequences associated with it(!) > > Both sequences display > > Sequence for identity column: .
.id > > when described with \d in psql. > > Trying to drop either sequence results in > > Try: > > ALTER SEQUENCE some_seq_name OWNED BY none; > DROP SEQUENCE some_seq_name; > > Best regards, > > depesz > From depesz@depesz.com Fri May 15 23:23:37 2026 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 1vE4xP-004NS3-Rw for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 12:07:15 +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 1vE4xO-000eWF-Pj for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 12:07:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vE4xO-000eW6-Ep for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 12:07:13 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vE4xL-004seP-1f for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 12:07:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version :References:Reply-To:Message-ID:Subject:Cc:To:Sender:From:Date:Content-ID: Content-Description; bh=htVYT3DXpthkFkEsPLefkwLyG0gq2jPCvUd+4YTv+E4=; b=buee2 MOLgtZVEtxI1QlbT+cw/1qKl1yDV9GZMG5kRGn3qAmjEdN/FLGC0UTGcM+p+6k5Ag9nptjCMfk8L0 /oCeuidbtJz7UNk4tkuaNTJ/AljV2BCVjbhbThGmXa/Ler4Q8+twVca4XOi9Yj/pSFLfz7XXN8rhA oS5za9/gA73A=; Received: from depesz by depesz.com with local (Exim 4.96) (envelope-from ) id 1vE4xI-0034Vw-2C; Wed, 29 Oct 2025 13:07:09 +0100 Date: Wed, 29 Oct 2025 13:07:08 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Colin 't Hart Cc: PostgreSQL General Subject: Re: Two sequences associated with one identity column Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Oct 29, 2025 at 01:04:48PM +0100, Colin 't Hart wrote: > Thanks. But as I wrote above, trying to alter either of the two > sequences and specifying "owned by none" results in the error. Sorry, missed that. Can you please provide pg_dump output from this db, just schema, just this one table, and both sequences? Or, how did you arrive at this situation? Did you try to alter table … alter column … drop identity; Best regards, depesz From colinthart@gmail.com Fri May 15 23:23:16 2026 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 1vE6PX-004z06-O5 for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 13:40:23 +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 1vE6PW-001GfX-Dh for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 13:40:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vE6PW-001GfP-2r for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 13:40:21 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vE6PT-004tN2-0f for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 13:40:20 +0000 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-b6ce806af3eso6697719a12.0 for ; Wed, 29 Oct 2025 06:40:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761745217; x=1762350017; darn=lists.postgresql.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=o46Wo7yjF6nDI/k/x8ajJ62xH1/fOhmMLwFjmDOnV3E=; b=KD6KOuoOcUGMWbgslSE4k8rE2sz4GUDHq8nwIX+4XgxbHf8O12RxI4oTW3DOR8tpnR tei3R9ckYaaf64UaZ4yJ0xKf6xv1HPTqRDrZSvUlPG01SXQ43m92zCj7PfKUX37mElvl kRzeIkBIqMnjd363N5/OvpK/vA7NF80fBu59U205jgd74ISBMpyseb6mVQNGZeh5vM1x c+MmSdakDjPR6o9gp8AGr88G6tlDHbXYz9rw0c+pYWUUP/eHEhpm0dhaOwExSzt2gPj2 GxMqiG1ybE4B6fKaqh7k23dyzWCjuWtO+5d+PM0EYwQrsWJUems222cVYT8Qqkr5alDt RJpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761745217; x=1762350017; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o46Wo7yjF6nDI/k/x8ajJ62xH1/fOhmMLwFjmDOnV3E=; b=OrWlNfhmlgHGtwmCAoU8JhFJ+rI59qO/oPDrr48GeLssS9VkmfvBO8IgXSPvUNg3A/ qqppKEax+rVb+7cvpSAKAxRvN/rGkOh/5U7bPmoV62zcELKsV34OiA6Fy+F3uPmJcDjB PjFDPlTKAp6ZM0SVejnekOmd+PHRwz8ZXw54BeyOTzqoGMFq4lp4QA/JgYF9VCsLdRPA nmTXKBlSq5g9hXP9QjIcR2WLRHS0T8oIdbYu9oxq9sQ1yN9cSeqg6TpFCa8RRjLZc2nA ZEZj5z1ZrCeplUvEzbUQht7G1gkb9aRO0c1/ZRK3NksFsH77nKkXj6RgVF9JBR1NKVS0 2CSA== X-Gm-Message-State: AOJu0Yxvymkuq7ppX/m/A9DO/YYVREc+aeaYqeBAVFPJGmWD98plS3rK Mqbfg6mqA6Yw3LB1sB83AVRV27Dsh9ekwe2AqEHJdfUvrMpLbDFUAn05MFfictojiz/ddzeNMES N7vyjouJRt7ac22FX14KfYrul1QcJAUq57b8LqPE= X-Gm-Gg: ASbGncuoxG2Icvfux+2Ec59Pgw02CCtQPWW8zDH7yaYRIcrdrOZ3NreUVGII/Ax2fFR /+f9A3b/wj3CA5tJSkrJ0gvilwCyfKCGeo7hj6kVAF0QBtNBYd/u0Ydw7uJuGdxjHV+Adbh6dx3 pRNbH8H6ND8rOT+gyu6iI/zUGGuJnFXpLBY+PD8tNNUX+wYhSTB1fdp4M0IPP1JPsIuqNBFaR/w uEsXCUowUEp6S/H2Sk9RPWKvyarzzHxvzxfJ0pws3UjHuuFoSjWNMDqnwHoYcUQe2z1wrZpHepm jUoLb009qE82f1/BQkCnaT3gUVq4kCjSi+xeT78rVkLRb1vO9EWMS9JBvGx+QLERrfdWKL9YdZy QQJgJ0aWNk/g+7eLO5LAmFKxg6g== X-Google-Smtp-Source: AGHT+IGHTSd3nNghE8SAXje/xLSlK6pOJdQP5Cg5OCTeeNzDJHrM9K/hAx9VVPrLHNmqiqaSSRe0i+wuK+GlL3L6zEI= X-Received: by 2002:a17:902:968b:b0:28a:2e51:9272 with SMTP id d9443c01a7336-294def2d984mr30713885ad.48.1761745216819; Wed, 29 Oct 2025 06:40:16 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Colin 't Hart" Date: Wed, 29 Oct 2025 14:40:03 +0100 X-Gm-Features: AWmQ_bmzUNasa37gAdQj_aNxWE_110SuEXjAWlHS6Kb9B0fTYUBlgcdAsTv3esw Message-ID: Subject: Re: Two sequences associated with one identity column To: PostgreSQL General Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk As expected the dump contains: CREATE TABLE . ( , id bigint NOT NULL ); -- -- Name: ; Type: SEQUENCE; Schema: ; Owner: -- ALTER TABLE . ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( SEQUENCE NAME . START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 ); -- -- Name: ; Type: SEQUENCE; Schema: ; Owner: -- ALTER TABLE . ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( SEQUENCE NAME . START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 ); Two things are interesting: 1. The id column is last, so quite possibly added later (instead of the original PK which was dropped?) 2. The two sequences are just dumped -- which causes an error when importin= g. A third thing that is interesting is that I can drop the table just fine -- and both sequences get dropped along with it. The table seems to be relatively small -- and has no foreign keys -- so I think the solution will be to recreate the table (create table as select), drop the original table and finally rename the new table the same as the old one. Also checking to see if the problem extends to the other environments. /Colin On Wed, 29 Oct 2025 at 13:07, hubert depesz lubaczewski wrote: > > On Wed, Oct 29, 2025 at 01:04:48PM +0100, Colin 't Hart wrote: > > Thanks. But as I wrote above, trying to alter either of the two > > sequences and specifying "owned by none" results in the error. > > Sorry, missed that. > > Can you please provide pg_dump output from this db, just schema, just > this one table, and both sequences? > > Or, how did you arrive at this situation? > > Did you try to alter table =E2=80=A6 alter column =E2=80=A6 drop identity= ; > > Best regards, > > depesz > From kurt@thepw.com Fri May 15 23:23:08 2026 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 1vE7Se-005bq0-7z for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 14:47:40 +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 1vE7Sb-001V0b-34 for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 14:47:36 +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 1vE7Sa-001V0S-8x for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 14:47:35 +0000 Received: from mail-northcentralusazlp170100001.outbound.protection.outlook.com ([2a01:111:f403:c105::1] helo=CH1PR05CU001.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vE7SW-004OuM-06 for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 14:47:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lk3aILkbFJyjUTlJJ6UNHMM1AK8fIDAWT+XwLTcxrhwN0BbMUg2/BTUKBt0NEkhYnHThFukYuhdSjgWOTHjN2lTgDDf/AYpG6ALqHVsrQvSuGjTuqYSuUUF9ICi+krKfvpM5Wep3X+WGIWbqLEIu6KgzroK8L0I4FPsNjIr/aQKk501u8c0bVsof076oQ3V0vxa/Ysmqz3txv0QqmdWSv6eD8YVrr//2fvk8ALuzPxlr5VtV95SCvST8/eNs8hnDK91C5N4o6BBqMgnWg9XUvW0dveBsAxqGpUFI0oDRG2iv4LMxM2KRf0ytjWORJS+VksD/S/tua/H7PzYLLWZlyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PpFvqL8y65hsde0oW8EphPdILIwiiwSaYlcZpLHIAzs=; b=EvLEYOdojXzdEdBMbaxKDiYQjPG3EWk0Fd7+NcRz65tjAvj8ucOfxtry0nFK93ZdMw5zDuCiqK1MT06+LM3ynWYzzxKv7M0m5lEJ86NDCZ3TQkZqGeYq+NaWvdgH0XcQHJT1BgUFVoyF8jCHucydqjWB9ZKRJMWBoWPXqF7sSicHnjpwbtkU+7usXvBj/7R0Wy5IK9Dc8IkIfTW+TBFXf6S1k/wMIJuoJgUzp6r5NsN4Rcwx/RzMIDrn8Q64MVW1HSZS0xJXomzXBd/sUtIG/28QJzZmlQKlUWqygYYbPlKaR1OemNw+EDAfBHtJPJ5WaGc1Wx/dKGxqkys5HZiucQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=thepw.com; dmarc=pass action=none header.from=thepw.com; dkim=pass header.d=thepw.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thepw.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PpFvqL8y65hsde0oW8EphPdILIwiiwSaYlcZpLHIAzs=; b=FNepdaQZipVAgjTVcIXzBGN9JbONmHHfez2GixJwPnhHu0jQYCRN55C36tNk4d32m/rSFT6PQDh7tQCMTxbnx1mRjf5H9GC2GnQagXUMcNqYoTp3aQF/o5OisaGnevL5AUFHdhZ+lNIrt9i954MCbc7f4coVbvDQu1k1Xxj9KilQ7gRK7PPkmIERk8GE7rPg3O6R/cRVmW7BJYBdJ6cAEk5EK6Ig9nOZL/MNd+GmpsccABj9PitdjHrG49uGyLwib3SJBwAcrBgC1qUHc3oRTZHl64BDtujjsXC6qqU5D6NAZPLNNnYOiZcjHWPUO0XWN0UVDAbfme65F1q9LOBLUw== Received: from BN8PR07MB5905.namprd07.prod.outlook.com (2603:10b6:408:69::26) by BY5PR07MB7250.namprd07.prod.outlook.com (2603:10b6:a03:20b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9275.13; Wed, 29 Oct 2025 14:47:24 +0000 Received: from BN8PR07MB5905.namprd07.prod.outlook.com ([fe80::6c92:be07:f146:c63b]) by BN8PR07MB5905.namprd07.prod.outlook.com ([fe80::6c92:be07:f146:c63b%5]) with mapi id 15.20.9275.011; Wed, 29 Oct 2025 14:47:24 +0000 From: kurt thepw.com To: Colin 't Hart , PostgreSQL General Subject: Re: Two sequences associated with one identity column Thread-Topic: Two sequences associated with one identity column Thread-Index: AQHcSMcgK4OvlbsN6Eigz34vjyB0QbTZBl4AgAABSKuAABnagIAABm/h Date: Wed, 29 Oct 2025 14:47:24 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=thepw.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN8PR07MB5905:EE_|BY5PR07MB7250:EE_ x-ms-office365-filtering-correlation-id: 7ab45503-a507-4300-7fac-08de16fa12d6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|1800799024|376014|38070700021|8096899003; x-microsoft-antispam-message-info: =?Windows-1252?Q?MDLgF8TLOcQUiax3SgsRefuSrHMTkdD4QBjQ8aCq3QI+mKlkpE8WKqyK?= =?Windows-1252?Q?9u4pIGiAyvve+qo8bCHrie9muJfZPQ7uA5O7l4yfQ3vya/DTuTupoZ2Z?= =?Windows-1252?Q?KXmV91VjV1GxBpKR3ix9fd8vLG2BnUxFvGM3QD2IniFeXGAKecUnK6Nw?= =?Windows-1252?Q?4yz+2vG7kzSVdUhWGO4RMIrzvNJUAxYoNNIpgDXF+aePwVz0YiWlJjGL?= =?Windows-1252?Q?yE5lh7JnzAFDcq259v34ENar91nKcamPxpFOUg17hs5nTtErrrHKkBhi?= =?Windows-1252?Q?e1dL3oHXeo83wMZ+OqwP0uzGAP6oFpTJlZE5dnmrdrGlUxeD6PrklMOt?= =?Windows-1252?Q?wqD/L6FsGzgybawMbx8AZEBKEhhgg8JTvUsDZjzq+agPzDZBDVZ3x1tT?= =?Windows-1252?Q?lPIXDATAP7qTqBFGzpV3fQZ89zjuhy78khRiOWUG9hXRqIkJv4yZmxaX?= =?Windows-1252?Q?Nabl+ZpIckLnvNju4VLuMGewPCKD9jkBbCF2qpOBnamEvfHphU4COjZ7?= =?Windows-1252?Q?dFeZaMywLWh699MRFBhRCndzwVdEkFfZBsmYp3tjaTvwyCrA9qpYe9VW?= =?Windows-1252?Q?tO5rGCSR9O6bg4fJmpyRl0iCbx7xYzF1ocwfIjK9odokVpOZLSX7KlE7?= =?Windows-1252?Q?HTU/C/Ibe7WsAqHvXXomziiEDPlTEeyGDRKnpdhN/mrH1Zl2pQxDX7vb?= =?Windows-1252?Q?Q0Fn0/qxYlrzCdG8kHNONJyEPdMuFRBGdv0bAbZhBLvwF0P2DqwrPDet?= =?Windows-1252?Q?igIiXAUICKKVDXnbMRpwOR3gVk2QntKvR7/leSf85I2517qmCphLQ+A8?= =?Windows-1252?Q?7u+7h+ca6u4Wx23EUbQ3tt6xFM55YJY84cj5sCdK+cD5Ov+jqGe1R+MJ?= =?Windows-1252?Q?J79Vn5htklcHyznNPE9rGxfo5Xp+5dyxLoEHiuCsbTQ3W0K0g3XScjEz?= =?Windows-1252?Q?V3YCah/EP6VK6wcNFjStwFjnAaaJPxH0eYDzV9R5gKYqV5Do23a29h8L?= =?Windows-1252?Q?egXUOgC0aBqmUtLoIV84JhCs5kCE1YUxcLMIcac66BccUyU+aH7spfkl?= =?Windows-1252?Q?B1qZ5EOgT7LKi7u9EwqZHh6W/obM7d2qxAYr4OnJVGe+MJY1WCPBz0PC?= =?Windows-1252?Q?9kslOz8NUQwSSMg5B9S3E7uW+S1YQWgJ+DhPsLOhCnh4CocdUgIA3ine?= =?Windows-1252?Q?6cM/mxcRwUucWEoWKNehH1dI1wE/DOqZSPyWNrHPEvU4ylqmcqC6E6Zu?= =?Windows-1252?Q?3r/I32T8P4AXf/GPS5BShu37ZfRS49zhBdodZ9Kbyws0RJTzCIStPt/V?= =?Windows-1252?Q?RiNrAbvz11MtKrqeG/GGxQefpcZ2PXaF2mZ1KuJigZ881Oftu9itW4HR?= =?Windows-1252?Q?2q0Sdc58qRzNywToP+gYOlR1fKkk0zq7yyQPk4BwELhabYjbXsUjslE3?= =?Windows-1252?Q?oVAtuKAX1E57++0yDvnfgM+nWiAcTxE0NnpphLNtg+8x56UR5Ad6zFNf?= =?Windows-1252?Q?lLBtwk+ERr3eJnYsTtP7fpqTIkEUXth+2dOQRCvK1+NGtTQTx9y7QUNW?= =?Windows-1252?Q?euEH9cmzfPhQxgJ179iiML9hNNDkO5HEA9iqZJG8/QqxR1RTuTqGYm+m?= =?Windows-1252?Q?86awbdmVrwMAzyW00kNSvjNe?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR07MB5905.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(38070700021)(8096899003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?OUyxK154ibIw4wkLSWl53jInXysMW+nYQto5nOl+DLHJ2ZCCXO3+DDU6?= =?Windows-1252?Q?Wag+EQrdIdmfCa4OeGfBX3p4ArjNG9tQUfJ/jYwAyEjrySHdqaNv18ei?= =?Windows-1252?Q?bhA3JT/WkKcKbpdHk5WescmeC8X3pgxYOAgrq4AZ6wMrmqDju41MmE65?= =?Windows-1252?Q?2dx7RbicjSeoVbsGkMC0coMhKBC/tZGMgfHiecyN70GOOQ1wye9lZO6I?= =?Windows-1252?Q?JUiQsnE2RzmirMpk9B6bIVLdswUka8C7lnefA6/yJcg+Zj0iu30Wyi8L?= =?Windows-1252?Q?XYsQgE62oFOnKDwWZhBIFxhWDBJNs76N5yYizy3UdDaxiJwTxqjXd6b/?= =?Windows-1252?Q?Zy8Yadrtpq30rkoA02kEk8c77Cof/QsfzU2RAwLrh7JlhpGFgTlVDDDG?= =?Windows-1252?Q?QIS3fB4TEMJkY7rRq2Vn1qz/PrGCNP0vHyNBzQD2FNUXmJ+2l63tMI90?= =?Windows-1252?Q?BjXu37mA/WIK6vZ8g/DJcY5bTuI8e+gDn0Mf8Y3weeGaBonkpWjRlfXq?= =?Windows-1252?Q?4LRVVQzqw/jEZTYNcfyOvKcZia+x2P/vP6m1jRrYHiSEOL8SFSDgJe/p?= =?Windows-1252?Q?SPf6j85OO8WhoKtSC1b51lILvQ32+5RdMkVf2ds6BiMsU1ie5sdCdC42?= =?Windows-1252?Q?sFdU/63pJwpqx1OE3G5qNa5R3E9kyTc97lrHK5XVQ3IYq85uhZ+OgKto?= =?Windows-1252?Q?5U10+wloaNq4L2axxXmgJ0EvLFxeLWrLbwxs7eiM/oJh0y+2qEZmkDOs?= =?Windows-1252?Q?8w0kmpY5UPQyNBpvaas3C/suG6oiRUF5u+fq2xLIVC9CjTq+D/89e3kr?= =?Windows-1252?Q?iz9hURuCpUpZpaqJ9wEP7P7IoNkBGwVO1xQ3Xk3tIv0lwcEkZSYet7PH?= =?Windows-1252?Q?rMXmjrFOVHiSxa8JwiEVIFxClRqhhiWpxeOphgxRtlYr5UcbrpiusfJO?= =?Windows-1252?Q?qOFhFXVcqCvZ0d9PM4IfF6HdRdBbyriWLedHlyJPIW6z1JAaprrpi48C?= =?Windows-1252?Q?y8wJsb7xRMTpxGVpewVTrQU5pFTpmVy2f/WCwmdjxZfWS/1WPIkocAmI?= =?Windows-1252?Q?X0w0mwhFMqz2Xv0P2Sp5sgWjWOp1QUWkRD7dd83WpN8A1jKfyAl/kjy7?= =?Windows-1252?Q?hrS25CPmjICzCH0rMADZkYoYL59TeQDEdfCTOESK5hFmImoorfECeB0Q?= =?Windows-1252?Q?sjVUUfykrLJnbVNojFV5/2yCQgmNhhBNL1ElBbxHNNqmcostlpumlvUH?= =?Windows-1252?Q?Xd1eo+C1DEgI72fxq3coyKk+UFUynegbhS1qFJuT2hz1xIiw1/UjEu/5?= =?Windows-1252?Q?5x9yHGGKeHwE54t4n5s3lAZ3sh8wUaMk9fusQYetGd4KIPUVDlgN9x+e?= =?Windows-1252?Q?kTvvyXVp6uNeTAYobkNYjaEQ84ys/yFbMjsxXbmqiU5DXvBSKnq0Zdeo?= =?Windows-1252?Q?xMWZR0xNcVGCFCaoNDSCvxpEyTSiNS+mWuMD0EH50PNCaymuLl2+Sekq?= =?Windows-1252?Q?3wSQVkqLNOHmu6mehgUQWOOb08NCKSoYI0d97mG0r/Wmt9YKWnLSYnk6?= =?Windows-1252?Q?GClT+tQtkYGdrbMF0xE9WbEFGNtflutnSVRl4Xu/CddxTXkbN48tFVel?= =?Windows-1252?Q?Vc4x1YJNEr3D+6CjDdUwQahqD0f8cYosMkLEEjGv40+AXh/tB1Id40dV?= =?Windows-1252?Q?ON3QOBvT2tU=3D?= Content-Type: multipart/alternative; boundary="_000_BN8PR07MB5905FE3F05381DDBFFDEDA9FD3FAABN8PR07MB5905namp_" MIME-Version: 1.0 X-OriginatorOrg: thepw.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR07MB5905.namprd07.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ab45503-a507-4300-7fac-08de16fa12d6 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Oct 2025 14:47:24.5893 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 2b55f125-3527-485e-ac77-3a5c553302cd X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: C+XNMNSVMzKumQSBAdnVAEw2GCc4MRoohOEzKzhmzfEp7vYg+PCAVRja9oxknsbf X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR07MB7250 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_BN8PR07MB5905FE3F05381DDBFFDEDA9FD3FAABN8PR07MB5905namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable < < CREATE TABLE . ( < , < id bigint NOT NULL < ); < I've never seen a plaintext pg_dump output where the sequence associated w= ith a column in a table was not mentioned in s "DEFAULT nextval(..." modifi= er in that column's line of the CREATE TABLE statement, ex: < < CREATE TABLE . ( < id integer DEFAULT nextval('.'::regclass) NOT NULL, < ..., < . . . . . < ); With the sequence already created earlier in the dump file. But then, I've = never before seen a table column with two associated sequences. Maybe that = is what makes pg_dump generate the "ALTER TABLE . ALTER COLUMN id ADD GENERATED..." Statements. < < 1. The id column is last, so quite possibly added later (instead of < the original PK which was dropped?) < That seems likely, and probably the 2nd sequence was added in by someone wh= o didn't know (or forgot) about the first one. < < 2. The two sequences are just dumped -- which causes an error when import= ing. < I'd be curious to know if simple editing out the 2nd "ALTER TABLE...ADD GEN= ERATED.." statement would allow a restore of the database to succeed. pg_re= store dorsn't work with plaintext files, you have to cat them into psql or = use the '-f' switch. < < A third thing that is interesting is that I can drop the table just < fine -- and both sequences get dropped along with it. < The table seems to be relatively small -- and has no foreign keys -- < so I think the solution will be to recreate the table (create table as < select), drop the original table and finally rename the new table the < same as the old one. < That's probably the quickest way to fix it, though if you are "create table= as select.."-ing from the old table you might get the two sequences again.= I've never used "create table as select" . An alternative might be to pg_dump just that table, edit the .sql file, dro= p the table, and then restore. Kurt ________________________________ From: Colin 't Hart Sent: Wednesday, October 29, 2025 9:40 AM To: PostgreSQL General Subject: Re: Two sequences associated with one identity column As expected the dump contains: CREATE TABLE . ( , id bigint NOT NULL ); -- -- Name: ; Type: SEQUENCE; Schema: ; Owner: -- ALTER TABLE . ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( SEQUENCE NAME . START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 ); -- -- Name: ; Type: SEQUENCE; Schema: ; Owner: -- ALTER TABLE . ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( SEQUENCE NAME . START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 ); Two things are interesting: 1. The id column is last, so quite possibly added later (instead of the original PK which was dropped?) 2. The two sequences are just dumped -- which causes an error when importin= g. A third thing that is interesting is that I can drop the table just fine -- and both sequences get dropped along with it. The table seems to be relatively small -- and has no foreign keys -- so I think the solution will be to recreate the table (create table as select), drop the original table and finally rename the new table the same as the old one. Also checking to see if the problem extends to the other environments. /Colin On Wed, 29 Oct 2025 at 13:07, hubert depesz lubaczewski wrote: > > On Wed, Oct 29, 2025 at 01:04:48PM +0100, Colin 't Hart wrote: > > Thanks. But as I wrote above, trying to alter either of the two > > sequences and specifying "owned by none" results in the error. > > Sorry, missed that. > > Can you please provide pg_dump output from this db, just schema, just > this one table, and both sequences? > > Or, how did you arrive at this situation? > > Did you try to alter table =85 alter column =85 drop identity; > > Best regards, > > depesz > --_000_BN8PR07MB5905FE3F05381DDBFFDEDA9FD3FAABN8PR07MB5905namp_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

<
< CREATE TABLE <schema>.<tablename> (
< <other columns>,
<   id bigint NOT NULL
< );
<

I've never seen a plaintext pg_dump  output where the sequence associa= ted with a column in a table was not mentioned in s "DEFAULT nextval(.= .." modifier in that column's line of the CREATE TABLE statement, ex:<= br>
<
< CREATE TABLE <schema>.<tbl> (
<    id integer DEFAULT nextval('<schema>.<seqname>= ;'::regclass) NOT NULL,
<    <next column>...,
<   .  .  .  .  .
<  );

With the sequence already created earlier in the dump file. But then, I've = never before seen a table column with two associated sequences. Maybe that = is what makes pg_dump generate the

"ALTER TABLE <schema>.<tablename> ALTER COLUMN id ADD GENE= RATED..."

Statements. 

<
< 1. The id column is last, so quite possibly added later (instead of
< the original PK which was dropped?)
<
That seems likely, and probably the 2nd sequence was added = in by someone who didn't know (or forgot) about the first one.

<
< 2. The two sequences are just dumped -- which causes an error when imp= orting.
<
I'd be curious to know if simple editing out the 2nd "= ALTER TABLE...ADD GENERATED.." statement would allow a restore of the = database to succeed. pg_restore dorsn't work with plaintext files, you have= to cat them into psql or use the '-f' switch. 

<
< A third thing that is interesting is that I can drop the table just
< fine -- and both sequences get dropped along with it.
< The table seems to be relatively small -- and has no foreign keys --
< so I think the solution will be to recreate the table (create table as=
< select), drop the original table and finally rename the new table the<= /div>
< same as the old one.
<

That's probably the quickest way to fix it, though if you are "create = table as select.."-ing from the old table you might get the two sequen= ces again. I've never used "create table as select" . 

An alternative might be to pg_dump just that table, edit the .sql file, dro= p the table, and then restore.

Kurt


From: Colin 't Hart <col= inthart@gmail.com>
Sent: Wednesday, October 29, 2025 9:40 AM
To: PostgreSQL General <pgsql-general@lists.postgresql.org> Subject: Re: Two sequences associated with one identity column
 
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
);


Two things are interesting:
1. The id column is last, so quite possibly added later (instead of
the original PK which was dropped?)
2. The two sequences are just dumped -- which causes an error when importin= g.

A third thing that is interesting is that I can drop the table just
fine -- and both sequences get dropped along with it.

The table seems to be relatively small -- and has no foreign keys --
so I think the solution will be to recreate the table (create table as
select), drop the original table and finally rename the new table the
same as the old one.

Also checking to see if the problem extends to the other environments.

/Colin



On Wed, 29 Oct 2025 at 13:07, hubert depesz lubaczewski
<depesz@depesz.com> wrote:
>
> On Wed, Oct 29, 2025 at 01:04:48PM +0100, Colin 't Hart wrote:
> > Thanks. But as I wrote above, trying to alter either of the two > > sequences and specifying "owned by none" results in the= error.
>
> Sorry, missed that.
>
> Can you please provide pg_dump output from this db, just schema, just<= br> > this one table, and both sequences?
>
> Or, how did you arrive at this situation?
>
> Did you try to alter table =85 alter column =85 drop identity;
>
> Best regards,
>
> depesz
>


--_000_BN8PR07MB5905FE3F05381DDBFFDEDA9FD3FAABN8PR07MB5905namp_-- From adrian.klaver@aklaver.com Fri May 15 23:23:27 2026 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 1vE92R-006Bv7-9P for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 16:28:42 +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 1vE92P-002HQU-5T for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 16:28:40 +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 1vE92O-002HQM-9y for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 16:28:39 +0000 Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1vE92L-004Pgf-1Q for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 16:28:38 +0000 Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 5DCDE14000DA; Wed, 29 Oct 2025 12:28:36 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Wed, 29 Oct 2025 12:28:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1761755316; x=1761841716; bh=hxjqGDv9d4EfewFpJ3Bcy00D1SBm7aPI8JDPyLiIhe8=; b= K6lNcNBgW2TBGCyEaiSw5ioP4wFNaZ9EHRsmSIpWjPvBKpEHUpsvX8iGjdQfw+mY 8tbj8CHBPISjpacoDZO2cRtnH9lTBlMmHzPVXaiBvL9hT7MuPrcU/dGXSLjdi9K/ vhY3THkSUhLJ+yXRC14y8OypON8Kv5aCqbcxyoarl6c2nUiLvd+hYXU/MGU7F2nE 4gcQTXK4INiiLi/2hDn7qihEo2WlenjdcsOvdvsO2re5z+BOIe6te1dWVgtqrbcn ag+aWDcQX+6AhzmtF2MGxqUmqeZCnU0ysrSbzmEM2/sJxvmI6fOEK8ce7re0ZAXS kJPjG0iaHUc3mW5hahEl5w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1761755316; x=1761841716; bh=h xjqGDv9d4EfewFpJ3Bcy00D1SBm7aPI8JDPyLiIhe8=; b=TyPYUjCx06HuvCMbO ZriK/7pDpHoHyjl7RXb7hed6i4U7VM8woCEwPKjoPJKTKFWrYl7rILOawPtLbn0O dqb4A5eJbKLLyGZPaCh6oMlGXXPRnMzOGUMxwBvLrPlKi1sZNTtdoEvCmuyS/dcI zyxHF5bQsdz2Qlw4mDMRRxQN+jFIRaX93GJKfdoZgyuvt3lQbFRv/6GH6i89rIpc vNSAkBaUaQ4pU1D+yD/AgG33h4/JXUdxw7f5QrV4p0CXsb4qKLwrmM1LukGZNSus NQsEnCfrKv284TsfkVsMiHfIdXABPu8SzUABgE6KevjWv6ueGrT0nijuzcotoYx6 XDpSQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduieegvdduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeenucfhrhhomheptegurhhirghn ucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqe enucggtffrrghtthgvrhhnpeeivdfhieehheegueeileejieettdejhedugeefleekvdel keehtdfgiefffeekudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggp rhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegtohhlihhnth hhrghrthesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghl sehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Oct 2025 12:28:34 -0400 (EDT) Message-ID: Date: Wed, 29 Oct 2025 09:28:33 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Two sequences associated with one identity column To: Colin 't Hart , PostgreSQL General References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/29/25 06:40, Colin 't Hart wrote: > As expected the dump contains: > > CREATE TABLE . ( > , > id bigint NOT NULL > ); > > > > -- > -- Name: ; Type: SEQUENCE; Schema: ; Owner: > -- > > ALTER TABLE . ALTER COLUMN id ADD GENERATED ALWAYS > AS IDENTITY ( > SEQUENCE NAME . > START WITH 1 > INCREMENT BY 1 > NO MINVALUE > NO MAXVALUE > CACHE 1 > ); > > > -- > -- Name: ; Type: SEQUENCE; Schema: ; Owner: > -- > > ALTER TABLE . ALTER COLUMN id ADD GENERATED ALWAYS > AS IDENTITY ( > SEQUENCE NAME . > START WITH 1 > INCREMENT BY 1 > NO MINVALUE > NO MAXVALUE > CACHE 1 > ); Just a wild guess. Assuming is the same, what is the output of: SELECT relname, relnamespace, relpersistence FROM pg_class WHERE relname IN ('', ' ') AND relnamespace = ''::regnamespace; > > /Colin > -- Adrian Klaver adrian.klaver@aklaver.com