Compare commits

...

6 Commits

Author SHA1 Message Date
opengauss-bot ada51c9fea
!1574 修复升级场景下_jsonb类型oid随机分配的问题
Merge pull request !1574 from 胡正超/jsonboid2.1.0
2022-03-14 13:37:12 +00:00
gentle_hu 1f6832d30b fix oid of _jsonb in upgrade case 2022-03-09 19:15:36 +08:00
opengauss-bot d8cd223c53
!1494 fix unique index of column table
Merge pull request !1494 from zhengxue/2.1.0
2022-01-24 03:25:47 +00:00
shirley_zhengx fcad3b1ccd fix unique index of column table 2022-01-21 18:44:23 +08:00
opengauss-bot 1f18fce639
!1458 fix upgrade of gs_encrypted_proc
Merge pull request !1458 from zhengxue/2.1.0_dev
2022-01-11 07:43:53 +00:00
shirley_zhengx 1ded1fec93 fix upgrade of gs_encrypted_proc 2022-01-08 16:41:13 +08:00
7 changed files with 29 additions and 15 deletions

View File

@ -271,6 +271,7 @@ typedef struct AlteredTableInfo {
List* changedConstraintDefs; /* string definitions of same */
List* changedIndexOids; /* OIDs of indexes to rebuild */
List* changedIndexDefs; /* string definitions of same */
bool isDeltaTable; /* delta table or not */
} AlteredTableInfo;
/* Struct describing one new constraint to check in Phase 3 scan */
@ -451,7 +452,8 @@ static void createForeignKeyTriggers(
Relation rel, Oid refRelOid, Constraint* fkconstraint, Oid constraintOid, Oid indexOid);
static void ATController(Relation rel, List* cmds, bool recurse, LOCKMODE lockmode);
static bool ATCheckLedgerTableCmd(Relation rel, AlterTableCmd* cmd);
static void ATPrepCmd(List** wqueue, Relation rel, AlterTableCmd* cmd, bool recurse, bool recursing, LOCKMODE lockmode);
static void ATPrepCmd(List** wqueue, Relation rel, AlterTableCmd* cmd, bool recurse, bool recursing, LOCKMODE lockmode,
bool isDeltaTable = false);
static void ATRewriteCatalogs(List** wqueue, LOCKMODE lockmode);
static void ATExecCmd(List** wqueue, AlteredTableInfo* tab, Relation rel, AlterTableCmd* cmd, LOCKMODE lockmode);
static void ATRewriteTables(List** wqueue, LOCKMODE lockmode);
@ -493,7 +495,7 @@ static void ExecChangeTableSpaceForRowPartition(AlteredTableInfo*, LOCKMODE);
static void ExecChangeTableSpaceForCStoreTable(AlteredTableInfo*, LOCKMODE);
static void ExecChangeTableSpaceForCStorePartition(AlteredTableInfo*, LOCKMODE);
static AlteredTableInfo* ATGetQueueEntry(List** wqueue, Relation rel);
static AlteredTableInfo* ATGetQueueEntry(List** wqueue, Relation rel, bool isDeltaTable = false);
static void ATSimplePermissions(Relation rel, int allowed_targets);
static void ATWrongRelkindError(Relation rel, int allowed_targets);
static void ATSimpleRecursion(List** wqueue, Relation rel, AlterTableCmd* cmd, bool recurse, LOCKMODE lockmode);
@ -7070,13 +7072,14 @@ static void ATController(Relation rel, List* cmds, bool recurse, LOCKMODE lockmo
* Caller must have acquired appropriate lock type on relation already.
* This lock should be held until commit.
*/
static void ATPrepCmd(List** wqueue, Relation rel, AlterTableCmd* cmd, bool recurse, bool recursing, LOCKMODE lockmode)
static void ATPrepCmd(List** wqueue, Relation rel, AlterTableCmd* cmd, bool recurse, bool recursing, LOCKMODE lockmode,
bool isDeltaTable)
{
AlteredTableInfo* tab = NULL;
int pass;
/* Find or create work queue entry for this table */
tab = ATGetQueueEntry(wqueue, rel);
tab = ATGetQueueEntry(wqueue, rel, isDeltaTable);
/*
* Copy the original subcommand for each table. This avoids conflicts
@ -7511,7 +7514,7 @@ static void ATRewriteCatalogs(List** wqueue, LOCKMODE lockmode)
* ATExecAlterColumnType since it should be done only once if
* multiple columns of a table are altered).
*/
if (pass == AT_PASS_ALTER_TYPE)
if (pass == AT_PASS_ALTER_TYPE && !tab->isDeltaTable)
ATPostAlterTypeCleanup(wqueue, tab, lockmode);
relation_close(rel, NoLock);
@ -8547,7 +8550,7 @@ static void ATOnlyCheckCStoreTable(const AlteredTableInfo* tab, Relation rel)
/*
* ATGetQueueEntry: find or create an entry in the ALTER TABLE work queue
*/
static AlteredTableInfo* ATGetQueueEntry(List** wqueue, Relation rel)
static AlteredTableInfo* ATGetQueueEntry(List** wqueue, Relation rel, bool isDeltaTable)
{
Oid relid = RelationGetRelid(rel);
AlteredTableInfo* tab = NULL;
@ -8567,7 +8570,7 @@ static AlteredTableInfo* ATGetQueueEntry(List** wqueue, Relation rel)
tab->relid = relid;
tab->relkind = rel->rd_rel->relkind;
tab->oldDesc = CreateTupleDescCopy(RelationGetDescr(rel));
tab->isDeltaTable = isDeltaTable;
*wqueue = lappend(*wqueue, tab);
return tab;
@ -8700,17 +8703,18 @@ static void ATSimpleRecursion(List** wqueue, Relation rel, AlterTableCmd* cmd, b
Oid relid = RelationGetRelid(rel);
ListCell* child = NULL;
List* children = NIL;
bool isDeltaStore = RelationIsCUFormat(rel);
#ifdef ENABLE_MULTIPLE_NODES
if (g_instance.attr.attr_storage.enable_delta_store && RelationIsCUFormat(rel))
#else
isDeltaStore = g_instance.attr.attr_storage.enable_delta_store && isDeltaStore;
#endif
if (isDeltaStore)
/*
* Under centrailzed mode, there may be unique index on delta table. When checking unique
* constraint, unique index on delta will be used. So we ignore enable_delta_store here
* and alter delta table at the same time.
*/
if (RelationIsCUFormat(rel))
#endif
children = find_cstore_delta(rel, lockmode);
else
children = find_all_inheritors(relid, lockmode, NULL);
@ -8729,7 +8733,7 @@ static void ATSimpleRecursion(List** wqueue, Relation rel, AlterTableCmd* cmd, b
/* find_all_inheritors already got lock */
childrel = relation_open(childrelid, NoLock);
CheckTableNotInUse(childrel, "ALTER TABLE");
ATPrepCmd(wqueue, childrel, cmd, false, true, lockmode);
ATPrepCmd(wqueue, childrel, cmd, false, true, lockmode, isDeltaStore);
relation_close(childrel, NoLock);
}
}

View File

@ -254,7 +254,9 @@ BEGIN
end if;
END$$;
DROP TYPE IF EXISTS pg_catalog._jsonb;
DROP TYPE IF EXISTS pg_catalog.jsonb;
DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE;
DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT encrypt_result_str text) CASCADE;DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE;
DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT encrypt_result_str text) CASCADE;DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE;

View File

@ -254,7 +254,9 @@ BEGIN
end if;
END$$;
DROP TYPE IF EXISTS pg_catalog._jsonb;
DROP TYPE IF EXISTS pg_catalog.jsonb;
DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE;
DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT encrypt_result_str text) CASCADE;DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE;
DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT encrypt_result_str text) CASCADE;DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE;

View File

@ -1,8 +1,9 @@
--------------------------------------------------------------
-- add new type jsonb
--------------------------------------------------------------
DROP TYPE IF EXISTS pg_catalog._jsonb;
DROP TYPE IF EXISTS pg_catalog.jsonb;
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_TYPE, 3802, 0, b;
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_TYPE, 3802, 3807, b;
CREATE TYPE pg_catalog.jsonb;
DROP FUNCTION IF EXISTS pg_catalog.jsonb_in(cstring) CASCADE;

View File

@ -16,3 +16,5 @@ SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0,
CREATE UNIQUE INDEX gs_encrypted_proc_func_id_index ON pg_catalog.gs_encrypted_proc USING BTREE(func_id OID_OPS);
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0;
GRANT SELECT ON pg_catalog.gs_encrypted_proc TO PUBLIC;

View File

@ -1,8 +1,9 @@
--------------------------------------------------------------
-- add new type jsonb
--------------------------------------------------------------
DROP TYPE IF EXISTS pg_catalog._jsonb;
DROP TYPE IF EXISTS pg_catalog.jsonb;
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_TYPE, 3802, 0, b;
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_TYPE, 3802, 3807, b;
CREATE TYPE pg_catalog.jsonb;
DROP FUNCTION IF EXISTS pg_catalog.jsonb_in(cstring) CASCADE;

View File

@ -16,3 +16,5 @@ SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0,
CREATE UNIQUE INDEX gs_encrypted_proc_func_id_index ON pg_catalog.gs_encrypted_proc USING BTREE(func_id OID_OPS);
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0;
GRANT SELECT ON pg_catalog.gs_encrypted_proc TO PUBLIC;