pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15685: pg_upgrade fails to migrate DEFAULT values that use custom TYPEs or FUNCTIONs
2+ messages / 2 participants
[nested] [flat]

* BUG #15685: pg_upgrade fails to migrate DEFAULT values that use custom TYPEs or FUNCTIONs
@ 2019-03-11 08:49  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2019-03-11 08:49 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: justusgraf@gmx.de

The following bug has been logged on the website:

Bug reference:      15685
Logged by:          Justus Graf
Email address:      justusgraf@gmx.de
PostgreSQL version: 11.2
Operating system:   Debian GNU/Linux 9.8 (stretch)
Description:        

Hey there,

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

We did experience something similar when using pg_restore in the past, not
sure if that helps or if you could give us any hints how this can be
avoided?

Best,

Justus



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #15685: pg_upgrade fails to migrate DEFAULT values that use custom TYPEs or FUNCTIONs
@ 2019-03-11 15:48  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2019-03-11 15:48 UTC (permalink / raw)
  To: justusgraf@gmx.de; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-03-11 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-03-11 08:49 BUG #15685: pg_upgrade fails to migrate DEFAULT values that use custom TYPEs or FUNCTIONs PG Bug reporting form <noreply@postgresql.org>
2019-03-11 15:48 ` Tom Lane <tgl@sss.pgh.pa.us>

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