void check_new_cluster(void) { set_locale_and_encoding(&new_cluster); check_locale_and_encoding(&old_cluster.controldata, &new_cluster.controldata); get_db_and_rel_infos(&new_cluster); check_new_cluster_is_empty(); check_loadable_libraries(); if (user_opts.transfer_mode == TRANSFER_MODE_LINK) check_hard_link(); check_is_super_user(&new_cluster); /* * We don't restore our own user, so both clusters must match have * matching install-user oids. */ if (old_cluster.install_role_oid != new_cluster.install_role_oid) pg_fatal("Old and new cluster install users have different values for pg_authid.oid.\n"); /* * We only allow the install user in the new cluster because other defined * users might match users defined in the old cluster and generate an * error during pg_dump restore. */ if (new_cluster.role_count != 1) pg_fatal("Only the install user can be defined in the new cluster.\n"); check_for_prepared_transactions(&new_cluster); }
void check_new_cluster(void) { set_locale_and_encoding(&new_cluster); check_new_db_is_empty(); check_loadable_libraries(); check_locale_and_encoding(&old_cluster.controldata, &new_cluster.controldata); if (user_opts.transfer_mode == TRANSFER_MODE_LINK) check_hard_link(); }
void check_and_dump_old_cluster(bool live_check) { /* -- OLD -- */ if (!live_check) start_postmaster(&old_cluster, true); set_locale_and_encoding(&old_cluster); get_pg_database_relfilenode(&old_cluster); /* Extract a list of databases and tables from the old cluster */ get_db_and_rel_infos(&old_cluster); init_tablespaces(); get_loadable_libraries(); /* * Check for various failure cases */ check_is_install_user(&old_cluster); check_for_prepared_transactions(&old_cluster); check_for_reg_data_type_usage(&old_cluster); check_for_isn_and_int8_passing_mismatch(&old_cluster); /* Pre-PG 9.4 had a different 'line' data type internal format */ if (GET_MAJOR_VERSION(old_cluster.major_version) <= 903) old_9_3_check_for_line_data_type_usage(&old_cluster); /* Pre-PG 9.0 had no large object permissions */ if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804) new_9_0_populate_pg_largeobject_metadata(&old_cluster, true); /* * While not a check option, we do this now because this is the only time * the old server is running. */ if (!user_opts.check) generate_old_dump(); if (!live_check) stop_postmaster(false); }
void check_new_cluster(void) { set_locale_and_encoding(&new_cluster); get_db_and_rel_infos(&new_cluster); check_new_cluster_is_empty(); check_for_prepared_transactions(&new_cluster); check_old_cluster_has_new_cluster_dbs(); check_loadable_libraries(); check_locale_and_encoding(&old_cluster.controldata, &new_cluster.controldata); if (user_opts.transfer_mode == TRANSFER_MODE_LINK) check_hard_link(); }
void check_old_cluster(bool live_check, char **sequence_script_file_name) { /* -- OLD -- */ if (!live_check) start_postmaster(&old_cluster); set_locale_and_encoding(&old_cluster); get_pg_database_relfilenode(&old_cluster); /* Extract a list of databases and tables from the old cluster */ get_db_and_rel_infos(&old_cluster); init_tablespaces(); get_loadable_libraries(); /* * Check for various failure cases */ check_is_super_user(&old_cluster); check_for_prepared_transactions(&old_cluster); check_for_reg_data_type_usage(&old_cluster); check_for_isn_and_int8_passing_mismatch(&old_cluster); /* old = PG 8.3 checks? */ if (GET_MAJOR_VERSION(old_cluster.major_version) <= 803) { old_8_3_check_for_name_data_type_usage(&old_cluster); old_8_3_check_for_tsquery_usage(&old_cluster); old_8_3_check_ltree_usage(&old_cluster); if (user_opts.check) { old_8_3_rebuild_tsvector_tables(&old_cluster, true); old_8_3_invalidate_hash_gin_indexes(&old_cluster, true); old_8_3_invalidate_bpchar_pattern_ops_indexes(&old_cluster, true); } else /* * While we have the old server running, create the script to * properly restore its sequence values but we report this at the * end. */ *sequence_script_file_name = old_8_3_create_sequence_script(&old_cluster); } /* Pre-PG 9.0 had no large object permissions */ if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804) new_9_0_populate_pg_largeobject_metadata(&old_cluster, true); /* * While not a check option, we do this now because this is the only time * the old server is running. */ if (!user_opts.check) { generate_old_dump(); split_old_dump(); } if (!live_check) stop_postmaster(false); }