提交 96e953a7 编写于 作者: H Heikki Linnakangas

Fix bugs in pg_upgrade_support functions, for GPDB 5 -> GPDB 5 ugprade.

These patches were written by Daniel Gustafsson, I just squashed and
rebased them.

* Add missing 5.0 object procedure declarations

Commit 7ec83119 implemented support for 5.0 objects in
binary upgrade, but missed adding the procedure declarations to
pg_upgrade due to a mismerge.

* Fix opclass Oid preassignment function

The function was erroneously pulling the wrong argument for the
namespace Oid resulting in failed Oid lookups during synchronization.

* Add support functions for pg_amop tuples
上级 5c97bd91
......@@ -153,6 +153,48 @@ install_system_functions_internal(migratorContext *ctx, char *dbname)
"RETURNS VOID "
"AS '$libdir/pg_upgrade_support' "
"LANGUAGE C STRICT;"));
PQclear(executeQueryOrDie(ctx, conn,
"CREATE OR REPLACE FUNCTION "
"binary_upgrade.preassign_tsparser_oid(OID, OID, TEXT) "
"RETURNS VOID "
"AS '$libdir/pg_upgrade_support' "
"LANGUAGE C STRICT;"));
PQclear(executeQueryOrDie(ctx, conn,
"CREATE OR REPLACE FUNCTION "
"binary_upgrade.preassign_tsdict_oid(OID, OID, TEXT) "
"RETURNS VOID "
"AS '$libdir/pg_upgrade_support' "
"LANGUAGE C STRICT;"));
PQclear(executeQueryOrDie(ctx, conn,
"CREATE OR REPLACE FUNCTION "
"binary_upgrade.preassign_tstemplate_oid(OID, OID, TEXT) "
"RETURNS VOID "
"AS '$libdir/pg_upgrade_support' "
"LANGUAGE C STRICT;"));
PQclear(executeQueryOrDie(ctx, conn,
"CREATE OR REPLACE FUNCTION "
"binary_upgrade.preassign_tsconfig_oid(OID, OID, TEXT) "
"RETURNS VOID "
"AS '$libdir/pg_upgrade_support' "
"LANGUAGE C STRICT;"));
PQclear(executeQueryOrDie(ctx, conn,
"CREATE OR REPLACE FUNCTION "
"binary_upgrade.preassign_extension_oid(OID, OID, TEXT) "
"RETURNS VOID "
"AS '$libdir/pg_upgrade_support' "
"LANGUAGE C STRICT;"));
PQclear(executeQueryOrDie(ctx, conn,
"CREATE OR REPLACE FUNCTION "
"binary_upgrade.preassign_enum_oid(OID, OID, TEXT) "
"RETURNS VOID "
"AS '$libdir/pg_upgrade_support' "
"LANGUAGE C STRICT;"));
PQclear(executeQueryOrDie(ctx, conn,
"CREATE OR REPLACE FUNCTION "
"binary_upgrade.preassign_amop_oid(OID, OID) "
"RETURNS VOID "
"AS '$libdir/pg_upgrade_support' "
"LANGUAGE C STRICT;"));
PQfinish(conn);
}
......
......@@ -13,6 +13,7 @@
#include "fmgr.h"
#include "catalog/dependency.h"
#include "catalog/oid_dispatch.h"
#include "catalog/pg_amop.h"
#include "catalog/pg_attrdef.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_cast.h"
......@@ -86,6 +87,7 @@ Datum preassign_tstemplate_oid(PG_FUNCTION_ARGS);
Datum preassign_tsconfig_oid(PG_FUNCTION_ARGS);
Datum preassign_extension_oid(PG_FUNCTION_ARGS);
Datum preassign_enum_oid(PG_FUNCTION_ARGS);
Datum preassign_amop_oid(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(preassign_type_oid);
PG_FUNCTION_INFO_V1(preassign_arraytype_oid);
......@@ -114,6 +116,7 @@ PG_FUNCTION_INFO_V1(preassign_tstemplate_oid);
PG_FUNCTION_INFO_V1(preassign_tsconfig_oid);
PG_FUNCTION_INFO_V1(preassign_extension_oid);
PG_FUNCTION_INFO_V1(preassign_enum_oid);
PG_FUNCTION_INFO_V1(preassign_amop_oid);
Datum
preassign_type_oid(PG_FUNCTION_ARGS)
......@@ -200,7 +203,7 @@ preassign_opclass_oid(PG_FUNCTION_ARGS)
{
Oid opcoid = PG_GETARG_OID(0);
char *objname = GET_STR(PG_GETARG_TEXT_P(1));
Oid opcnamespace = PG_GETARG_OID(1);
Oid opcnamespace = PG_GETARG_OID(2);
if (Gp_role == GP_ROLE_UTILITY)
{
......@@ -548,3 +551,22 @@ preassign_enum_oid(PG_FUNCTION_ARGS)
PG_RETURN_VOID();
}
Datum
preassign_amop_oid(PG_FUNCTION_ARGS)
{
Oid amopoid = PG_GETARG_OID(0);
Oid amopmethod = PG_GETARG_OID(1);
if (Gp_role == GP_ROLE_UTILITY)
{
AddPreassignedOidFromBinaryUpgrade(amopoid,
AccessMethodOperatorRelationId,
NULL,
InvalidOid,
amopmethod,
InvalidOid);
}
PG_RETURN_VOID();
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册