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 1tsOIM-001STW-8o for pgsql-general@arkaria.postgresql.org; Wed, 12 Mar 2025 15:46:58 +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 1tsOIJ-007XYo-Uf for pgsql-general@arkaria.postgresql.org; Wed, 12 Mar 2025 15:46:55 +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 1tsOII-007XYZ-VV for pgsql-general@lists.postgresql.org; Wed, 12 Mar 2025 15:46:55 +0000 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tsOIG-002RyE-1p for pgsql-general@postgresql.org; Wed, 12 Mar 2025 15:46:53 +0000 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 539B8114022C; Wed, 12 Mar 2025 11:46:51 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Wed, 12 Mar 2025 11:46:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc: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=fm3; t=1741794411; x=1741880811; bh=Us3x0Tv5Z3ucoja8NRSMQu4zrFId3yvEXDxIfxakF0Q=; b= FxvKQSgv51o9HkL92ksCYQNXI9WXo+rGGXFSg1SbsFzyL47b1YnSxj9HMX3mnWLf yisQGysoTnMgTtnHKD/vzYb8lKRmG01zlZuOp7Fq4QdCnep8cEXkVxp0x2OxV+hI HvCRLK3IjFF2wEZ+kixry9+7gMts1Lt4nXtrchlZ0lAvQAP4sZAAp5ZKG68OwDXf 9Lg19MTpD3EdEYkaw52dfLq5vLkvb7nzPYgPhMscn8tcwfnKZOzg4Ui9Ngpx2VbV b8niSp/f39DJH+ls3qdmSdIJiZ4gEmgx1g6QWmNQFXp2OdqEoUWDHYrLtN1AQXCm KK8+TAHjLyJHA8y6u4goAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm1; t=1741794411; x= 1741880811; bh=Us3x0Tv5Z3ucoja8NRSMQu4zrFId3yvEXDxIfxakF0Q=; b=h JV0g92JmGhevE47ERFeTD64AQTPcBXi3Cn3Gt8eqeyofuZChYPhNY34A96pt84wQ ZHfzWTwY92CyrEb+7turHcUadS26bXpfbfgRxzIbVzm91AOwTwLyK15oqLMC7VwY JEFQpWScaN+Bnqj4Vd6M61cLhzLdmZWeY/hbtIZV1WQjRe7pZaJSZjnDeDtg1QSo CPeqF0CuZu3BU/MmTdwnwJzQgfXRyAIxLQLwZmRDOqzZZTKkM0ZJ9ua7NP2iQSxW 8+qIyFcd9M064iAMpn+4quRub0+ibDTiNxgz7bGIrdhNF7NmQQo7BIGnr6Jf9TVs 8bxH1dx7cmq5joC7pBL9g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvdehgeejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkff ggfgfuhffvvehfjggtgfesthekredttddvjeenucfhrhhomheptegurhhirghnucfmlhgr vhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtf frrghtthgvrhhnpeegjeekfefhgfdujeehhffhjeekgfehiedvueejjedugffggeegffdt hfdtuedtkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphht thhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehmrghrkhgsrhgrugihjh husehouhhtlhhoohhkrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlhes phhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 12 Mar 2025 11:46:50 -0400 (EDT) Message-ID: Date: Wed, 12 Mar 2025 08:46:49 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Duplicate Key Values From: Adrian Klaver To: mark bradley Cc: pgsql-general References: <9d919848-3fe1-46fd-b343-c5f2931864f7@aklaver.com> <513ddbee-135c-4af2-b6f6-acca667b8d09@aklaver.com> <84aac7bf-5638-4f1f-9772-ace0ea27e848@aklaver.com> <9203d0df-0ddd-4564-a985-59bcfcf1d294@aklaver.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/11/25 13:24, Adrian Klaver wrote: > On 3/11/25 12:55, mark bradley wrote: >> It happened again.  Now there are no sequences (although there once was). > > Read my previous post and provide the information requested. > Mark sent me the below, which answers some of the questions, namely there is inheritance going on: Universal Metadata Schema=# \d node Table "public.node" Column | Type | Collation | Nullable | Default -----------+-----------+-----------+----------+--------- node_id | integer | | not null | node_type | node_type | | not null | Indexes: "node_pkey" PRIMARY KEY, btree (node_id) "node_id" UNIQUE CONSTRAINT, btree (node_id) INCLUDE (node_id) Referenced by: TABLE "user_role" CONSTRAINT "a" FOREIGN KEY (node_id) REFERENCES node(node_i d) NOT VALID TABLE "dataset" CONSTRAINT "node_id" FOREIGN KEY (node_id) REFERENCES node(no de_id) NOT VALID Number of child tables: 2 (Use \d+ to list them.) Universal Metadata Schema=# \d dataset Table "public.dataset" Column | Type | Collation | Nullable | Default ---------------------------+---------------------------+-----------+----------+-- ------- node_id | integer | | not null | dataset_name | character varying(25) | | not null | notes | text | | | dataset_type | database_type | | | dataset_maturity | database_maturity_type | | | disposition | disposition_type | | | start_date | date | | | end_date | date | | | most_recent_update | date | | | update_periodicity | interval | | | system_of_record | text | | | point_of_contact | integer | | | dataset_url | text | | | classification_level | classification_level_type | | | physical_location | text | | | quality_control | yes_no_type | | | dataset_documentation_url | text | | | description | text | | | node_type | node_type | | | Indexes: "dataset_pkey" PRIMARY KEY, btree (node_id) Foreign-key constraints: "node_id" FOREIGN KEY (node_id) REFERENCES node(node_id) NOT VALID "poc" FOREIGN KEY (point_of_contact) REFERENCES poc(poc_id) NOT VALID Referenced by: TABLE "dataset_table" CONSTRAINT "dataset" FOREIGN KEY (node_id) REFERENCES d ataset(node_id) NOT VALID TABLE "system_dataset" CONSTRAINT "system_dataset_node_id_fkey" FOREIGN KEY ( node_id) REFERENCES dataset(node_id) NOT VALID Inherits: node Universal Metadata Schema=# \d processing_node Table "public.processing_node" Column | Type | Collation | Nullable | Default -----------------------+-----------------------+-----------+----------+--------- node_id | integer | | not null | processing_node_name | character varying(25) | | | description | text | | | notes | text | | | point_of_contact | integer | | not null | is_a_user_application | yes_no_type | | not null | node_type | node_type | | | Indexes: "processing_node_pkey" PRIMARY KEY, btree (node_id) Foreign-key constraints: "processing_node_point_of_contact_fkey" FOREIGN KEY (point_of_contact) REFERE NCES poc(poc_id) Referenced by: TABLE "system_processing_node" CONSTRAINT "system_processing_node_processing_ node_id_fkey" FOREIGN KEY (processing_node_id) REFERENCES processing_node(node_id ) NOT VALID Inherits: node Universal Metadata Schema=# ALTER TABLE node VALID ATE CONSTRAINT node_id; ERROR: constraint "node_id" of relation "node" is not a foreign key or check constraint Universal Metadata Schema=# ALTER TABLE dataset VA LIDATE CONSTRAINTnode_id; ERROR: syntax error at or near "CONSTRAINTnode_id " LINE 1: ALTER TABLE dataset VALIDATE CONSTRAINTnod e_id; ^ > Did you ever run VALIDATE CONSTRAINT against them? Here is the run Universal Metadata Schema=# ALTER TABLE node VALID ATE CONSTRAINT node_id; ERROR: constraint "node_id" of relation "node" is not a foreign key or check constraint Universal Metadata Schema=# Universal Metadata Schema=# ALTER TABLE dataset VA LIDATE CONSTRAINT node_id; ALTER TABLE Universal Metadata Schema=# -- Adrian Klaver adrian.klaver@aklaver.com