Re: BUG #15685: pg_upgrade fails to migrate DEFAULT values that use custom TYPEs or FUNCTIONs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: justusgraf(at)gmx(dot)de
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15685: pg_upgrade fails to migrate DEFAULT values that use custom TYPEs or FUNCTIONs
Date: 2019-03-11 15:48:55
Message-ID: 447.1552319335@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:
> we've recently migrated from PostgreSQL 9.5 to 11.2 and after pg_upgrade a
> couple of tables were in a "broken" state afterwards where they were lacking
> DEFAULT values that relied on custom TYPEs or FUNCTIONs so that after the
> upgrade, we needed to run migrations such as

> ALTER TABLE IF EXISTS table1
> ALTER COLUMN column1 SET DEFAULT unix_timestamp()
> ALTER TABLE IF EXISTS table2
> ALTER COLUMN column2 SET DEFAULT 'open'::recruitment_state

It's hard to say anything definitive without a lot more detail, but
my guess is that this was triggered by the recent security-related
changes to make pg_dump scripts run with restrictive search_path
settings. Probably what happened is that the custom objects you
were relying on contain non-schema-qualified references that fail
with a restrictive search_path, so that they didn't restore into
the new database. It's unclear though why that wouldn't have led
to pg_upgrade failing altogether.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2019-03-11 20:41:14 Re: BUG #15631: Generated as identity field in a temporary table with on commit drop corrupts system catalogs
Previous Message Andy Davis 2019-03-11 15:43:52 Re: BUG #15686: pg_dump: server version: 11.2; pg_dump version: 11.2