Re: PG upgrade 14->15 fails - database contains our own extension - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PG upgrade 14->15 fails - database contains our own extension
Date
Msg-id 961023.1665674598@sss.pgh.pa.us
Whole thread Raw
In response to Re: PG upgrade 14->15 fails - database contains our own extension  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: PG upgrade 14->15 fails - database contains our own extension  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: PG upgrade 14->15 fails - database contains our own extension  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> CREATE CAST (integer AS public.lbuid) WITH FUNCTION
> pg_catalog.int8(integer) AS IMPLICIT;
> CREATE CAST (bigint AS public.lbuid) WITHOUT FUNCTION AS IMPLICIT;
> CREATE CAST (public.lbuid AS bigint) WITHOUT FUNCTION AS IMPLICIT;

> That's not a valid dump ordering, and if I drop the casts and try to
> recreate them that way, it fails in the same way you saw.

> My guess is that this is a bug in Tom's commit
> b55f2b6926556115155930c4b2d006c173f45e65, "Adjust pg_dump's priority
> ordering for casts."

Hmm ... I think it's a very ancient bug that somehow David has avoided
tripping over up to now.  Namely, that we require the bigint->lbuid
implicit cast to exist in order to make that WITH FUNCTION cast, but
we fail to record it as a dependency during CastCreate.  So pg_dump
is flying blind as to the required restoration order, and if it ever
worked, you were just lucky.

We might be able to put in some kluge in pg_dump to make it less
likely to fail with existing DBs, but I think the true fix lies
in adding that dependency.

(I'm pretty skeptical about it being a good idea to have a set of
casts like this, but I don't suppose pg_dump is chartered to
editorialize on that.)

            regards, tom lane



pgsql-hackers by date:

Previous
From: Zhihong Yu
Date:
Subject: Re: Bloom filter Pushdown Optimization for Merge Join
Next
From: Tom Lane
Date:
Subject: Re: PG upgrade 14->15 fails - database contains our own extension