BUG #18367: Cannot drop schema

Started by PG Bug reporting formabout 2 years ago3 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 18367
Logged by: Charles Bochet
Email address: charles@twenty.com
PostgreSQL version: 15.5
Operating system: PostgreSQL 15.5 on x86_64-pc-linux-gnu, compiled b
Description:

When trying to drop a schema using DROP SCHEMA "brokenSchema";

I'm facing the following error:
requested object address for unsupported object class 2: text result ""

The schema is empty from any table, type, trigger...

I haven't found any reference to this error on the internet.

Thanks a lot,
Charles

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PG Bug reporting form (#1)
Re: BUG #18367: Cannot drop schema

PG Bug reporting form <noreply@postgresql.org> writes:

When trying to drop a schema using DROP SCHEMA "brokenSchema";

I'm facing the following error:
requested object address for unsupported object class 2: text result ""

The schema is empty from any table, type, trigger...

That shouldn't happen :-(. I am guessing the cause is a corrupt
entry in pg_depend. Class 2 is OCLASS_TYPE, so apparently some
type got dropped but its pg_depend entry wasn't cleaned out, so
DROP SCHEMA thinks there's still a dependent object.

I would try to pg_dump the database, and if you can do that and
reload successfully then discard the original. If you've found
one bit of catalog corruption there's likely more.

regards, tom lane

#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#2)
Re: BUG #18367: Cannot drop schema

On 2024-Feb-27, Tom Lane wrote:

I would try to pg_dump the database, and if you can do that and
reload successfully then discard the original. If you've found
one bit of catalog corruption there's likely more.

I second that recommendation. However, there's also pg_catcheck which
could help diagnose and fix things, in case a dump/restore of the whole
database is impractical. If you operate it wrong enough, you can
corrupt your whole database though.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
Voy a acabar con todos los humanos / con los humanos yo acabaré
voy a acabar con todos (bis) / con todos los humanos acabaré ¡acabaré! (Bender)