Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1paHc3-0003DI-JM for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Mar 2023 14:51:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1paHc2-0003VO-Fa for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Mar 2023 14:51:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1paHc2-0003UZ-7R for pgsql-bugs@lists.postgresql.org; Thu, 09 Mar 2023 14:51:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1paHbz-0006ZN-R6 for pgsql-bugs@lists.postgresql.org; Thu, 09 Mar 2023 14:51:21 +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 329EpJar376056; Thu, 9 Mar 2023 09:51:19 -0500 From: Tom Lane To: "Salavessa, Joao (Senior Developer)" cc: "pgsql-bugs@lists.postgresql.org" Subject: Re: PostgreSQL 14.7 "ALTER TABLE IF EXISTS" fails - ERROR: schema/relation "" does not exist In-reply-to: References: Comments: In-reply-to "Salavessa, Joao (Senior Developer)" message dated "Thu, 09 Mar 2023 13:00:04 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <376054.1678373479.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 09 Mar 2023 09:51:19 -0500 Message-ID: <376055.1678373479@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Salavessa, Joao (Senior Developer)" writes: > In PostgreSQL 14.7 (AWS RDS) the =E2=80=9CIF EXISTS=E2=80=9D seems to be= ignored for the =E2=80=9CALTER TABLE=E2=80=9D statement. > Example =E2=80=93 the query =E2=80=9CALTER TABLE IF EXISTS dummy.relatio= n DROP CONSTRAINT IF EXISTS dummy=E2=80=9D (when schema dummy doesn=E2=80=99= t exist, or when schema dummy exists but relation doesn=E2=80=99t) works o= n 14.6 but fails in 14.7. > Few outputs below: > ALTER TABLE IF EXISTS dummy.relation DROP CONSTRAINT IF EXISTS dummy --= running in PostgreSQL 14.6 > NOTICE: relation "relation" does not exist, skipping > OK It still works like that for me in 14.latest. Perhaps you installed an event trigger that is doing something incautious? regards, tom lane