Re: PostgreSQL 14.7 "ALTER TABLE IF EXISTS" fails - ERROR: schema/relation "<name>" does not exist

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Salavessa, Joao (Senior Developer)" <Joao(dot)Salavessa(at)sky(dot)uk>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: PostgreSQL 14.7 "ALTER TABLE IF EXISTS" fails - ERROR: schema/relation "<name>" does not exist
Date: 2023-03-09 14:51:19
Message-ID: 376055.1678373479@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Salavessa, Joao (Senior Developer)" <Joao(dot)Salavessa(at)sky(dot)uk> writes:
> In PostgreSQL 14.7 (AWS RDS) the “IF EXISTS” seems to be ignored for the “ALTER TABLE” statement.
> Example – the query “ALTER TABLE IF EXISTS dummy.relation DROP CONSTRAINT IF EXISTS dummy” (when schema dummy doesn’t exist, or when schema dummy exists but relation doesn’t) works on 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-03-09 15:01:48 Re: BUG #17827: Rule on insert into table doesn't work when excepting select from the table itself
Previous Message Dean Rasheed 2023-03-09 13:11:59 Re: BUG #17809: MERGE ... UPDATE fails with BEFORE ROW UPDATE trigger when target row updated concurrently