From 7b3c0feadd954bb564b7aabf742969931046f5d2 Mon Sep 17 00:00:00 2001 From: zhang_xubo <2578876417@qq.com> Date: Sat, 4 Mar 2023 18:51:00 +0800 Subject: [PATCH] support plpython language --- src/common/pl/plpython/plpy_exec.cpp | 4 ++-- src/common/pl/plpython/plpy_main.cpp | 2 +- src/common/pl/plpython/plpy_procedure.cpp | 2 +- src/gausskernel/process/tcop/utility.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/pl/plpython/plpy_exec.cpp b/src/common/pl/plpython/plpy_exec.cpp index 9545a443c..379483954 100644 --- a/src/common/pl/plpython/plpy_exec.cpp +++ b/src/common/pl/plpython/plpy_exec.cpp @@ -657,13 +657,13 @@ static HeapTuple PLy_modify_tuple(PLyProcedure* proc, PyObject* pltd, TriggerDat } else if (plval != Py_None) { PLyObToDatum* att = &proc->result.out.r.atts[atti]; - modvalues[i] = (att->func)(att, tupdesc->attrs[atti]->atttypmod, plval); + modvalues[i] = (att->func)(att, tupdesc->attrs[atti].atttypmod, plval); modnulls[i] = ' '; } else { modvalues[i] = InputFunctionCall(&proc->result.out.r.atts[atti].typfunc, NULL, proc->result.out.r.atts[atti].typioparam, - tupdesc->attrs[atti]->atttypmod); + tupdesc->attrs[atti].atttypmod); modnulls[i] = 'n'; } diff --git a/src/common/pl/plpython/plpy_main.cpp b/src/common/pl/plpython/plpy_main.cpp index 16d181156..276e4c473 100644 --- a/src/common/pl/plpython/plpy_main.cpp +++ b/src/common/pl/plpython/plpy_main.cpp @@ -13,6 +13,7 @@ #include "executor/spi.h" #include "executor/executor.h" #include "miscadmin.h" +#include "auditfuncs.h" #include "pgaudit.h" #include "utils/guc.h" #include "utils/memutils.h" @@ -29,7 +30,6 @@ #include "plpy_plpymodule.h" #include "plpy_procedure.h" -const int PGAUDIT_MAXLENGTH = 1024; /* exported functions */ #if PY_MAJOR_VERSION >= 3 diff --git a/src/common/pl/plpython/plpy_procedure.cpp b/src/common/pl/plpython/plpy_procedure.cpp index 537f3663f..dc72e347e 100644 --- a/src/common/pl/plpython/plpy_procedure.cpp +++ b/src/common/pl/plpython/plpy_procedure.cpp @@ -191,7 +191,7 @@ static PLyProcedure* PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is rvTypeStruct = (Form_pg_type)GETSTRUCT(rvTypeTup); /* Disallow pseudotype result, except for void or record */ if (rvTypeStruct->typtype == TYPTYPE_PSEUDO) { - if (procStruct->prorettype == TRIGGEROID || rettype == EVTTRIGGEROID) { + if (procStruct->prorettype == TRIGGEROID || procStruct->prorettype == EVTTRIGGEROID) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("trigger functions can only be called as triggers"))); diff --git a/src/gausskernel/process/tcop/utility.cpp b/src/gausskernel/process/tcop/utility.cpp index 94989b424..36d50148d 100755 --- a/src/gausskernel/process/tcop/utility.cpp +++ b/src/gausskernel/process/tcop/utility.cpp @@ -6244,7 +6244,7 @@ ProcessUtilitySlow(Node *parse_tree, break; case T_CreatePLangStmt: - if (!IsInitdb) + if (!IsInitdb && strncmp(((CreatePLangStmt*)parse_tree)->plname, "plpython", strlen("plpython")) != 0) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("new language is not yet supported."))); address = CreateProceduralLanguage((CreatePLangStmt*)parse_tree); #ifdef PGXC