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 1r8NCP-009XX1-P8 for pgsql-bugs@arkaria.postgresql.org; Wed, 29 Nov 2023 16:14:05 +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 1r8NCO-00Bebv-Gs for pgsql-bugs@arkaria.postgresql.org; Wed, 29 Nov 2023 16:14:04 +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 1r8NCO-00Bebn-8f for pgsql-bugs@lists.postgresql.org; Wed, 29 Nov 2023 16:14:04 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r8NCL-007xlQ-UT for pgsql-bugs@lists.postgresql.org; Wed, 29 Nov 2023 16:14:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3ATGE0qr306770; Wed, 29 Nov 2023 11:14:00 -0500 From: Tom Lane To: david@buildingfootprintusa.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18217: ALTER TABLE IF EXISTS not being honored with DROP CONSTRAINT IF EXISTS In-reply-to: <18217-c7180ab143091145@postgresql.org> References: <18217-c7180ab143091145@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 29 Nov 2023 14:59:59 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <306768.1701274440.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 29 Nov 2023 11:14:00 -0500 Message-ID: <306769.1701274440@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > I found this issue from running pg_restore with flags to clean and "if = > exists". pg_restore returns an error code which is generated from a que= ry > of the following form: > ALTER TABLE IF EXISTS ONLY public.foo DROP CONSTRAINT IF EXISTS foo_pkey This works for me in the current minor release (15.5): $ psql psql (15.5) Type "help" for help. postgres=3D# ALTER TABLE IF EXISTS ONLY public.foo DROP CONSTRAINT IF EXIS= TS foo_pkey; NOTICE: relation "foo" does not exist, skipping ALTER TABLE Please update. If you can still reproduce the problem in the current release, there must be some additional contributing factor -- please try to provide a self-contained test case. regards, tom lane