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 1vE4LX-004A87-7o for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 11:28:06 +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 1vE4LT-0009wT-NK for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2025 11:28:02 +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 1vE4LT-0009wL-C5 for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 11:28:02 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vE4LQ-004s9v-03 for pgsql-general@lists.postgresql.org; Wed, 29 Oct 2025 11:28:01 +0000 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-33e0008d3b3so7229654a91.3 for ; Wed, 29 Oct 2025 04:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761737276; x=1762342076; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=qsiRwNsP8LhkPllrpO9sTBH1fk/m+vT+cejiPIo+aTk=; b=TaKmh78nY0aCQjOugShW+yFNyp+M7QggOgxiJaUPgaj3V3feP/nxuQODWuT4YnzDSH gVs0JC6MhNJcO56Lk2MSYe+WZpOrrGz034XnOVTNu8xUc2uMlB8dFNeNABT54Q8r0d3d PpnWG8dOvwCKq0nB+yT39RNODmyUwAE86UA4J9hp5Mirf5wuxm8MGF/JZE9WjN02YY2b P4ir+iPIyRqpiM/8wOhYzEURMwIJLt//+SM5/3xwP87Xu+nvURsrRgPnq9Mm8BUZ95qA gq/YA6ky2/i8PtwMd/DkllATPnPF1ViBkVJHQo2kQoEmOY4K8sSl9exEEbqz+oewfO9n Q7xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761737276; x=1762342076; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qsiRwNsP8LhkPllrpO9sTBH1fk/m+vT+cejiPIo+aTk=; b=g+SWratpWlbgjRDmA/m0Np4GFsv+Z6FOW6EYnJwM4Q66SAGCVmbyehbzBwwY/kuB8R cT+wUBnCusapL3LPo9shuP4CJD5iE7c51ukOoHrMgI2Fg262nZJg3ezDyS/o48mgPznA CoP1dD/gnU0feNGChYOaEHBUeGYQIceJbP7sLDNBBPrF2GKHDvtPsG/r5/c6S7Kq3dXa SwhLLGxxcvHVHb8c4qCD9aymZcUjcRLGYqwzPq7y6fa+t9vw4tIaVg7zWTg3fgWpQnld uQX920ppFBHPP0zDQxstiZoCNKwCgfdF/XlZLJM5JEml7XjdF9ZHybO6++UkGaWV+Olc CJ9g== X-Gm-Message-State: AOJu0YxDO35ywsgKs2DME90jxax8Ds3P8/inrZz5fBhNrqZzPpZL0l9C eVfwX487DeO07EX4fqDzHqClmpFVLY/ca8y2+ZIv0O3BCekrc8c7anrthtpQ5Iznpl9TvV0mxdF xigrLcmwZIRJv6hLjCyf2hEvsKEbM0vB5tzN1Oqc= X-Gm-Gg: ASbGnct+psk2f1ThXZJH0l0OE0KU3QOaRTXA4XCC4YOHb3f3CPA1eflB93y2IEFaJej rcM0akzVnh/GuAl0W7S7PCh4LF84UIoXviV411XPtRVuM8pwwQRr3rRz/GBTQksm7MVdEY8vx5j M+Nbr9E1SEurWfYNx2ROXVKrAA9f+aXvxC4ueT2KBZ4JHXsm/23Cyzbj2I9PhER2FT+wH1S+ci5 YdXyMyNDugxfGoZhUasrgkWWvxzcH4XcDtZMNfIOXMlTlsLZQ0Ci/Ob/rrjGxGRj5743MxttsaQ yP2k/OggmqYhlvzrv+Zj74BeyBy1dGkM263hyIqu2n72CdmHBJyoRJkeUg0tODZ/iCi6mppCw85 u2Q/F0aafqpiKEvU/B5OA0xu8dQ== X-Google-Smtp-Source: AGHT+IFIBFu6+1xCC9ffFI5ns+ggrpDuee/bLePtxz1V+ugUurGvArKF3VeLpSDPmRNP88k7QPyp1m3KmJzA11OxePE= X-Received: by 2002:a17:902:f64f:b0:26e:d0aa:7690 with SMTP id d9443c01a7336-294deee2c19mr32312965ad.41.1761737276379; Wed, 29 Oct 2025 04:27:56 -0700 (PDT) MIME-Version: 1.0 From: "Colin 't Hart" Date: Wed, 29 Oct 2025 12:27:44 +0100 X-Gm-Features: AWmQ_bn8Evt63DEWRpQ-5-RpZVLNkphRneYwukHoT1LQDBJfOoI-2za-eTZ4aLU Message-ID: Subject: 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 Hi, 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. Inserting fails with "ERROR: more than one owned sequence found", as does trying to alter the table to drop the identity on that column. Trying to drop either sequence results in ERROR: cannot drop sequence because column id of table requires it HINT: You can drop column id of table instead. while trying to alter either sequence "owned by none" results in ERROR: cannot change ownership of identity sequence DETAIL: Sequence "" is linked to table "". How do we fix this? I presume we need to update the catalog directly to dissociate one of the sequences and after that drop the orphaned sequence. This is in a Postgres 12.22 database that we're trying to upgrade to Postgres 17 Thanks, Colin