mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Fix pg_upgrade of large object permissions by preserving pg_auth.oid,
which is stored in pg_largeobject_metadata. No backpatch to 9.0 because you can't migrate from 9.0 to 9.0 with the same catversion (because of tablespace conflict), and a pre-9.0 migration to 9.0 has not large object permissions to migrate.
This commit is contained in:
@ -33,7 +33,7 @@ generate_old_dump(void)
|
||||
*
|
||||
* This function splits pg_dumpall output into global values and
|
||||
* database creation, and per-db schemas. This allows us to create
|
||||
* the toast place holders between restoring these two parts of the
|
||||
* the support functions between restoring these two parts of the
|
||||
* dump. We split on the first "\connect " after a CREATE ROLE
|
||||
* username match; this is where the per-db restore starts.
|
||||
*
|
||||
|
@ -13,23 +13,16 @@
|
||||
|
||||
|
||||
/*
|
||||
* install_support_functions()
|
||||
* install_db_support_functions()
|
||||
*
|
||||
* pg_upgrade requires some support functions that enable it to modify
|
||||
* backend behavior.
|
||||
*/
|
||||
void
|
||||
install_support_functions(void)
|
||||
install_db_support_functions(const char *db_name)
|
||||
{
|
||||
int dbnum;
|
||||
|
||||
prep_status("Adding support functions to new cluster");
|
||||
|
||||
for (dbnum = 0; dbnum < new_cluster.dbarr.ndbs; dbnum++)
|
||||
{
|
||||
DbInfo *new_db = &new_cluster.dbarr.dbs[dbnum];
|
||||
PGconn *conn = connectToServer(&new_cluster, new_db->db_name);
|
||||
|
||||
PGconn *conn = connectToServer(&new_cluster, db_name);
|
||||
|
||||
/* suppress NOTICE of dropped objects */
|
||||
PQclear(executeQueryOrDie(conn,
|
||||
"SET client_min_messages = warning;"));
|
||||
@ -83,9 +76,13 @@ install_support_functions(void)
|
||||
"RETURNS VOID "
|
||||
"AS '$libdir/pg_upgrade_support' "
|
||||
"LANGUAGE C STRICT;"));
|
||||
PQclear(executeQueryOrDie(conn,
|
||||
"CREATE OR REPLACE FUNCTION "
|
||||
" binary_upgrade.set_next_pg_authid_oid(OID) "
|
||||
"RETURNS VOID "
|
||||
"AS '$libdir/pg_upgrade_support' "
|
||||
"LANGUAGE C STRICT;"));
|
||||
PQfinish(conn);
|
||||
}
|
||||
check_ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -282,7 +282,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
|
||||
" ON c.relnamespace = n.oid "
|
||||
" LEFT OUTER JOIN pg_catalog.pg_tablespace t "
|
||||
" ON c.reltablespace = t.oid "
|
||||
"WHERE (( n.nspname NOT IN ('pg_catalog', 'information_schema') "
|
||||
"WHERE (( n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade') "
|
||||
" AND c.oid >= %u "
|
||||
" ) OR ( "
|
||||
" n.nspname = 'pg_catalog' "
|
||||
|
@ -224,11 +224,15 @@ prepare_new_databases(void)
|
||||
|
||||
set_frozenxids();
|
||||
|
||||
/*
|
||||
* We have to create the databases first so we can create the toast table
|
||||
* placeholder relfiles.
|
||||
*/
|
||||
prep_status("Creating databases in the new cluster");
|
||||
|
||||
/* install support functions in the database used by GLOBALS_DUMP_FILE */
|
||||
install_db_support_functions(os_info.user);
|
||||
|
||||
/*
|
||||
* We have to create the databases first so we can install support
|
||||
* functions in all the other databases.
|
||||
*/
|
||||
exec_prog(true,
|
||||
SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on "
|
||||
/* --no-psqlrc prevents AUTOCOMMIT=off */
|
||||
@ -247,10 +251,20 @@ prepare_new_databases(void)
|
||||
static void
|
||||
create_new_objects(void)
|
||||
{
|
||||
int dbnum;
|
||||
|
||||
/* -- NEW -- */
|
||||
start_postmaster(&new_cluster, false);
|
||||
|
||||
install_support_functions();
|
||||
prep_status("Adding support functions to new cluster");
|
||||
|
||||
for (dbnum = 0; dbnum < new_cluster.dbarr.ndbs; dbnum++)
|
||||
{
|
||||
DbInfo *new_db = &new_cluster.dbarr.dbs[dbnum];
|
||||
|
||||
install_db_support_functions(new_db->db_name);
|
||||
}
|
||||
check_ok();
|
||||
|
||||
prep_status("Restoring database schema to new cluster");
|
||||
exec_prog(true,
|
||||
|
@ -324,7 +324,7 @@ void check_hard_link(void);
|
||||
|
||||
/* function.c */
|
||||
|
||||
void install_support_functions(void);
|
||||
void install_db_support_functions(const char *db_name);
|
||||
void uninstall_support_functions(void);
|
||||
void get_loadable_libraries(void);
|
||||
void check_loadable_libraries(void);
|
||||
|
Reference in New Issue
Block a user