pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: david@buildingfootprintusa.com
Subject: BUG #18217: ALTER TABLE IF EXISTS not being honored with DROP CONSTRAINT IF EXISTS
Date: Wed, 29 Nov 2023 14:59:59 +0000
Message-ID: <18217-c7180ab143091145@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18217
Logged by:          David Moss
Email address:      david@buildingfootprintusa.com
PostgreSQL version: 15.2
Operating system:   PostgreSQL 15.2 on x86_64-pc-linux-gnu
Description:        

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

In pg_admin this reports:

ERROR:  relation "public.foo" does not exist 
SQL state: 42P01

Running this same query in a 15.1 instance returns the expected behavior:

NOTICE:  relation "foo" does not exist, skipping
ALTER TABLE
Query returned successfully in 48 msec.

More detailed version info:

PostgreSQL 15.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.3.1 20180712
(Red Hat 7.3.1-12), 64-bit
vs.
PostgreSQL 15.1, compiled by Visual C++ build 1914, 64-bit



view thread (2+ messages)  latest in thread

Message-ID: <18217-c7180ab143091145@postgresql.org>
Permalink:  ../18217-c7180ab143091145@postgresql.org/
Also on:    postgresql.org/message-id/18217-c7180ab143091145@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, david@buildingfootprintusa.com
  Subject: Re: BUG #18217: ALTER TABLE IF EXISTS not being honored with DROP CONSTRAINT IF EXISTS
  In-Reply-To: <18217-c7180ab143091145@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox