Re: BUG #18217: ALTER TABLE IF EXISTS not being honored with DROP CONSTRAINT IF EXISTS

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: david(at)buildingfootprintusa(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18217: ALTER TABLE IF EXISTS not being honored with DROP CONSTRAINT IF EXISTS
Date: 2023-11-29 16:14:00
Message-ID: 306769.1701274440@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> 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 query
> 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=# ALTER TABLE IF EXISTS ONLY public.foo DROP CONSTRAINT IF EXISTS 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sri Mrudula Attili 2023-11-29 17:20:20 Re: Could not read from file "pg_subtrans/00F5" at offset 122880: Success.
Previous Message PG Bug reporting form 2023-11-29 14:59:59 BUG #18217: ALTER TABLE IF EXISTS not being honored with DROP CONSTRAINT IF EXISTS