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 1so33X-007tlb-6b for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 15:45: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 1so33W-00FKzB-LY for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 15:45:26 +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 1so33W-00FKxS-9A for pgsql-general@lists.postgresql.org; Tue, 10 Sep 2024 15:45:26 +0000 Received: from fout7-smtp.messagingengine.com ([103.168.172.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1so33S-000Uht-MM for pgsql-general@postgresql.org; Tue, 10 Sep 2024 15:45:25 +0000 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id A02D31380212; Tue, 10 Sep 2024 11:45:22 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Tue, 10 Sep 2024 11:45:22 -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=fm3; t=1725983122; x=1726069522; bh=lFeRV6Q/NGJAdqQTwL8ErdPu25YiPXhmDM5XKrEuk3M=; b= 7Pus6HivxEs567E2M8xH36hIM9q1zY6lc5QZdndOQz+k4dSYYCCmhlqa4YzMVjpT 9tomRMOP5ZUX9uLQBTkILt1U//2UjfKkwMP2LQD8KhIfynPaHC0hyAYVU8Rdx+ht /uTgroUIdrXZFoqi40sl181rcmv6mzo6l1RghlzRCzJXt9Cd7POfC/Asix1m65Ub p88I/hboLL96B/xohom6yGj9VhE8ywn9PnVctPyKvhONUteLe0I6CgQ5147gGJHm 4M5K3t1Vc5VgRM9WQ/Hd3w2oDaLJygdqtI6Xsb/oJxSEvtA5ubx4B5IJqybjmJ3M hDfi3u1f6F+TkK4IOJfrsQ== 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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1725983122; x= 1726069522; bh=lFeRV6Q/NGJAdqQTwL8ErdPu25YiPXhmDM5XKrEuk3M=; b=c ug2BW+Q7qygVsl7WnxDayZZtEqBqkip4ddG0K3gc6Tsly9oQru+CTVsFkETMlP1F Zyw0DN8OeoZu1MWKbTdp61XwCbOVamRqFJAZXTlTEyahJRdRn4/6FLmIVgFdKV36 6ySaLJJYtuxQmvIEu1rmDVwzDE+tVKVRp1U6V2Vw2iFH0rTrpFNaTm2G5guswt/t 7zXRiYLN1RO6y4dijJPNn6L16U7TIfC/+7nxqipETgqwlTbmNOUYdXuIw/Mx6oOW g4b29kt3H3iPcShybyTCY2iW7F6rnuU3eCAFTHqWf7ISQ6o6oYCXe7J5gEjcGTFB pRc0Z1V61wodGdnn5gIOw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudeiledgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeen ucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrse grkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeeivdfhieehheegueeileej ieettdejhedugeefleekvdelkeehtdfgiefffeekudenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhl rghvvghrrdgtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehrshhhvghprghrugesrghpphhlqdgvtghoshihshdrtghomhdprhgtphht thhopehpghhsqhhlqdhgvghnvghrrghlsehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 10 Sep 2024 11:45:22 -0400 (EDT) Message-ID: <28d34da0-c58c-4237-b71d-5907517ace45@aklaver.com> Date: Tue, 10 Sep 2024 08:45:21 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Removing duplicate rows in table To: Rich Shepard , pgsql-general@postgresql.org References: <32765388-836c-4c00-bad0-665f0aa77ea8@aklaver.com> <19803246-8b24-5055-ef26-adf7ade3eb@appl-ecosys.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: <19803246-8b24-5055-ef26-adf7ade3eb@appl-ecosys.com> 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 9/10/24 08:29, Rich Shepard wrote: > On Tue, 10 Sep 2024, Adrian Klaver wrote: > >> Is there a Primary Key or Unique index on this table? > > Adrian, > > No. It didn't occur to me to make the project number a PK as this table is > not related to others in the database. > > But, yesterday it occurred to me to make the proj_nbr a PK to eliminate > future issues. > You might want to do something like: select proj_nbr, count(*) as ct from projects group by proj_nbr; to see how big a problem it is. If it is only a few projects it could just a matter of manually deleting the extras. Whatever you do: 1) Make sure you have a backup of at least that table. 2) Do the data changes as BEGIN; COMMIT; or ROLLBACK; > Thanks, > > Rich > > -- Adrian Klaver adrian.klaver@aklaver.com