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 1so2sJ-007sef-Ao for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 15:33:52 +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 1so2sI-00F64o-4B for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 15:33:50 +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 1so2sH-00F64e-Po for pgsql-general@lists.postgresql.org; Tue, 10 Sep 2024 15:33:49 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1so2sF-000U9T-4M for pgsql-general@postgresql.org; Tue, 10 Sep 2024 15:33:48 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 299912A14D6 for ; Tue, 10 Sep 2024 08:33:46 -0700 (PDT) Date: Tue, 10 Sep 2024 08:33:46 -0700 (PDT) From: Rich Shepard To: pgsql-general@postgresql.org Subject: Re: Removing duplicate rows in table In-Reply-To: <2E60FD03-E5D9-42D6-A080-690A378AF862@thebuild.com> Message-ID: <8af99ac1-1ca6-e683-ca8a-1b35bad8ef3e@appl-ecosys.com> References: <2E60FD03-E5D9-42D6-A080-690A378AF862@thebuild.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 10 Sep 2024, Christophe Pettus wrote: > If you don't mind taking the time to swap tables, you can always do an > INSERT ... SELECT DISTINCT into a new table, and then swap it > with the existing table. Christophe, I'll make the proj_nbr table the PK then do as you recommend. Thank you, Rich