dont-return-in-middle-of-PG_TRY_v2.patch
text/x-patch
Filename: dont-return-in-middle-of-PG_TRY_v2.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
Series: patch v2
| File | + | − |
|---|---|---|
| src/pl/plpython/plpy_exec.c | 18 | 14 |
diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c
index 923703535a..7181b5e898 100644
--- a/src/pl/plpython/plpy_exec.c
+++ b/src/pl/plpython/plpy_exec.c
@@ -414,12 +414,12 @@ PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc)
PyObject *volatile args = NULL;
int i;
+ args = PyList_New(proc->nargs);
+ if (!args)
+ return NULL;
+
PG_TRY();
{
- args = PyList_New(proc->nargs);
- if (!args)
- return NULL;
-
for (i = 0; i < proc->nargs; i++)
{
PLyDatumToOb *arginfo = &proc->args[i];
@@ -684,18 +684,28 @@ PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc, HeapTuple *r
*pltrelid,
*plttablename,
*plttableschema;
- PyObject *pltargs,
+ PyObject *pltargs = NULL,
*pytnew,
*pytold;
PyObject *volatile pltdata = NULL;
char *stroid;
- PG_TRY();
+ pltdata = PyDict_New();
+ if (!pltdata)
+ return NULL;
+
+ if (tdata->tg_trigger->tgnargs)
{
- pltdata = PyDict_New();
- if (!pltdata)
+ pltargs = PyList_New(tdata->tg_trigger->tgnargs);
+ if (!pltargs)
+ {
+ Py_DECREF(pltdata);
return NULL;
+ }
+ }
+ PG_TRY();
+ {
pltname = PLyUnicode_FromString(tdata->tg_trigger->tgname);
PyDict_SetItemString(pltdata, "name", pltname);
Py_DECREF(pltname);
@@ -835,12 +845,6 @@ PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc, HeapTuple *r
int i;
PyObject *pltarg;
- pltargs = PyList_New(tdata->tg_trigger->tgnargs);
- if (!pltargs)
- {
- Py_DECREF(pltdata);
- return NULL;
- }
for (i = 0; i < tdata->tg_trigger->tgnargs; i++)
{
pltarg = PLyUnicode_FromString(tdata->tg_trigger->tgargs[i]);