!57 bugfix: change kernel to support some third-party extensions

Merge pull request !57 from 陈林锋/master
This commit is contained in:
opengauss-bot 2020-07-31 17:10:59 +08:00 committed by Gitee
commit bc7e4b2d87
3 changed files with 1 additions and 45 deletions

View File

@ -524,8 +524,7 @@ FdwRoutine* GetFdwRoutineByServerId(Oid serverid)
/* Get foreign-data wrapper OID for the server. */
tp = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(serverid));
if (!HeapTupleIsValid(tp))
ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("cache lookup failed for foreign server %u", serverid)));
return NULL;
serverform = (Form_pg_foreign_server) GETSTRUCT(tp);
fdwid = serverform->srvfdw;
ReleaseSysCache(tp);

View File

@ -1846,13 +1846,6 @@ Oid DefineRelation(CreateStmt* stmt, char relkind, Oid ownerId)
if (colDef->raw_default != NULL) {
RawColumnDefault* rawEnt = NULL;
if (relkind == RELKIND_FOREIGN_TABLE) {
if (!(IsA(stmt, CreateForeignTableStmt) &&
isMOTTableFromSrvName(((CreateForeignTableStmt*)stmt)->servername)))
ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("default values on foreign tables are not supported")));
}
Assert(colDef->cooked_default == NULL);
rawEnt = (RawColumnDefault*)palloc(sizeof(RawColumnDefault));
rawEnt->attnum = attnum;

View File

@ -3586,9 +3586,6 @@ void standard_ProcessUtility(Node* parse_tree, const char* query_string, ParamLi
} break;
case T_AlterDomainStmt:
#ifdef PGXC
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("domain is not yet supported.")));
#endif /* PGXC */
{
AlterDomainStmt* stmt = (AlterDomainStmt*)parse_tree;
@ -4240,10 +4237,6 @@ void standard_ProcessUtility(Node* parse_tree, const char* query_string, ParamLi
} break;
case T_RuleStmt: /* CREATE RULE */
#ifdef PGXC
if (!IsInitdb && !u_sess->attr.attr_sql.enable_cluster_resize && !u_sess->exec_cxt.extension_is_valid)
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("RULE is not yet supported.")));
#endif /* PGXC */
DefineRule((RuleStmt*)parse_tree, query_string);
#ifdef PGXC
if (IS_PGXC_COORDINATOR && !IsConnFromCoord()) {
@ -4927,10 +4920,6 @@ void standard_ProcessUtility(Node* parse_tree, const char* query_string, ParamLi
* ******************************** DOMAIN statements ****
*/
case T_CreateDomainStmt:
#ifdef PGXC
if (!IsInitdb && !u_sess->attr.attr_common.IsInplaceUpgrade)
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("domain is not yet supported.")));
#endif /* PGXC */
DefineDomain((CreateDomainStmt*)parse_tree);
#ifdef PGXC
if (IS_PGXC_COORDINATOR)
@ -8531,9 +8520,6 @@ void CheckObjectInBlackList(ObjectType obj_type, const char* query_string)
return;
else
break;
case OBJECT_AGGREGATE:
tag = "AGGREGATE";
break;
case OBJECT_OPERATOR:
tag = "OPERATOR";
break;
@ -8596,28 +8582,6 @@ void CheckObjectInBlackList(ObjectType obj_type, const char* query_string)
*/
bool CheckExtensionInWhiteList(const char* extension_name, uint32 hash_value, bool hash_check)
{
/* 2902411162 hash for fastcheck, the sql file is much shorter than published version. */
uint32 postgisHashHistory[POSTGIS_VERSION_NUM] = {2902411162, 2959454932};
/* check for extension name */
if (pg_strcasecmp(extension_name, "postgis") == 0) {
/* PostGIS is disabled under 300 deployment */
if (is_feature_disabled(POSTGIS_DOCKING)) {
return false;
}
if (hash_check && !isSecurityMode) {
/* check for postgis hashvalue */
for (int i = 0; i < POSTGIS_VERSION_NUM; i++) {
if (hash_value == postgisHashHistory[i]) {
return true;
}
}
} else {
return true;
}
}
return true;
}