Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ed05092

Browse files
committed
do not replicate securuty definer func as statement
1 parent 175001e commit ed05092

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

src/ddl.c

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -953,31 +953,14 @@ MtmExecutorStart(QueryDesc *queryDesc, int eflags)
953953
TargetEntry *tle = (TargetEntry *) lfirst(tlist);
954954
if (tle->expr && IsA(tle->expr, FuncExpr))
955955
{
956-
Oid func_oid = ((FuncExpr*)tle->expr)->funcid;
957-
if (!hash_search(MtmRemoteFunctions, &func_oid, HASH_FIND, NULL))
956+
Oid func_oid = ((FuncExpr*) tle->expr)->funcid;
957+
958+
if (hash_search(MtmRemoteFunctions, &func_oid, HASH_FIND, NULL))
958959
{
959-
Form_pg_proc funcform;
960-
bool is_sec_def;
961-
HeapTuple func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(func_oid));
962-
if (!HeapTupleIsValid(func_tuple))
963-
elog(ERROR, "cache lookup failed for function %u", func_oid);
964-
funcform = (Form_pg_proc) GETSTRUCT(func_tuple);
965-
is_sec_def = funcform->prosecdef;
966-
ReleaseSysCache(func_tuple);
967-
if (!is_sec_def)
968-
{
969-
continue;
970-
}
960+
MtmProcessDDLCommand(queryDesc->sourceText, true);
961+
MtmDDLStatement = queryDesc;
962+
break;
971963
}
972-
/*
973-
* Execute security defined functions or functions marked as remote at replicated nodes.
974-
* Them are executed as DDL statements.
975-
* All data modifications done inside this function are not replicated.
976-
* As a result generated content can vary at different nodes.
977-
*/
978-
MtmProcessDDLCommand(queryDesc->sourceText, true);
979-
MtmDDLStatement = queryDesc;
980-
break;
981964
}
982965
}
983966
}
@@ -1009,6 +992,7 @@ MtmExecutorFinish(QueryDesc *queryDesc)
1009992
RelationGetIndexList(rel);
1010993
}
1011994
if (rel->rd_replidindex == InvalidOid) {
995+
// XXX
1012996
MtmMakeRelationLocal(RelationGetRelid(rel));
1013997
continue;
1014998
}

0 commit comments

Comments
 (0)