summaryrefslogtreecommitdiff
path: root/src/pl/plpython
diff options
context:
space:
mode:
authorTom Lane2017-06-21 19:35:54 +0000
committerTom Lane2017-06-21 19:35:54 +0000
commit382ceffdf7f620d8f2d50e451b4167d291ae2348 (patch)
treef558251492f2c6f86e3566f7a82f9d00509122c2 /src/pl/plpython
parentc7b8998ebbf310a156aa38022555a24d98fdbfb4 (diff)
Phase 3 of pgindent updates.
Don't move parenthesized lines to the left, even if that means they flow past the right margin. By default, BSD indent lines up statement continuation lines that are within parentheses so that they start just to the right of the preceding left parenthesis. However, traditionally, if that resulted in the continuation line extending to the right of the desired right margin, then indent would push it left just far enough to not overrun the margin, if it could do so without making the continuation line start to the left of the current statement indent. That makes for a weird mix of indentations unless one has been completely rigid about never violating the 80-column limit. This behavior has been pretty universally panned by Postgres developers. Hence, disable it with indent's new -lpl switch, so that parenthesized lines are always lined up with the preceding left paren. This patch is much less interesting than the first round of indent changes, but also bulkier, so I thought it best to separate the effects. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
Diffstat (limited to 'src/pl/plpython')
-rw-r--r--src/pl/plpython/plpy_cursorobject.c6
-rw-r--r--src/pl/plpython/plpy_elog.c14
-rw-r--r--src/pl/plpython/plpy_elog.h2
-rw-r--r--src/pl/plpython/plpy_exec.c10
-rw-r--r--src/pl/plpython/plpy_plpymodule.c4
-rw-r--r--src/pl/plpython/plpy_procedure.c10
-rw-r--r--src/pl/plpython/plpy_spi.c8
-rw-r--r--src/pl/plpython/plpy_typeio.c2
8 files changed, 28 insertions, 28 deletions
diff --git a/src/pl/plpython/plpy_cursorobject.c b/src/pl/plpython/plpy_cursorobject.c
index 18e689f141..2ad663cf66 100644
--- a/src/pl/plpython/plpy_cursorobject.c
+++ b/src/pl/plpython/plpy_cursorobject.c
@@ -192,8 +192,8 @@ PLy_cursor_plan(PyObject *ob, PyObject *args)
PLy_elog(ERROR, "could not execute plan");
sv = PyString_AsString(so);
PLy_exception_set_plural(PyExc_TypeError,
- "Expected sequence of %d argument, got %d: %s",
- "Expected sequence of %d arguments, got %d: %s",
+ "Expected sequence of %d argument, got %d: %s",
+ "Expected sequence of %d arguments, got %d: %s",
plan->nargs,
plan->nargs, nargs, sv);
Py_DECREF(so);
@@ -501,7 +501,7 @@ PLy_cursor_close(PyObject *self, PyObject *unused)
if (!PortalIsValid(portal))
{
PLy_exception_set(PyExc_ValueError,
- "closing a cursor in an aborted subtransaction");
+ "closing a cursor in an aborted subtransaction");
return NULL;
}
diff --git a/src/pl/plpython/plpy_elog.c b/src/pl/plpython/plpy_elog.c
index c4806274bc..bb864899f6 100644
--- a/src/pl/plpython/plpy_elog.c
+++ b/src/pl/plpython/plpy_elog.c
@@ -25,10 +25,10 @@ static void PLy_traceback(PyObject *e, PyObject *v, PyObject *tb,
char **xmsg, char **tbmsg, int *tb_depth);
static void PLy_get_spi_error_data(PyObject *exc, int *sqlerrcode, char **detail,
char **hint, char **query, int *position,
- char **schema_name, char **table_name, char **column_name,
+ char **schema_name, char **table_name, char **column_name,
char **datatype_name, char **constraint_name);
static void PLy_get_error_data(PyObject *exc, int *sqlerrcode, char **detail,
- char **hint, char **schema_name, char **table_name, char **column_name,
+ char **hint, char **schema_name, char **table_name, char **column_name,
char **datatype_name, char **constraint_name);
static char *get_source_line(const char *src, int lineno);
@@ -122,7 +122,7 @@ PLy_elog(int elevel, const char *fmt,...)
{
ereport(elevel,
(errcode(sqlerrcode ? sqlerrcode : ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
- errmsg_internal("%s", primary ? primary : "no exception data"),
+ errmsg_internal("%s", primary ? primary : "no exception data"),
(detail) ? errdetail_internal("%s", detail) : 0,
(tb_depth > 0 && tbmsg) ? errcontext("%s", tbmsg) : 0,
(hint) ? errhint("%s", hint) : 0,
@@ -136,8 +136,8 @@ PLy_elog(int elevel, const char *fmt,...)
column_name) : 0,
(datatype_name) ? err_generic_string(PG_DIAG_DATATYPE_NAME,
datatype_name) : 0,
- (constraint_name) ? err_generic_string(PG_DIAG_CONSTRAINT_NAME,
- constraint_name) : 0));
+ (constraint_name) ? err_generic_string(PG_DIAG_CONSTRAINT_NAME,
+ constraint_name) : 0));
}
PG_CATCH();
{
@@ -317,11 +317,11 @@ PLy_traceback(PyObject *e, PyObject *v, PyObject *tb,
if (proname == NULL)
appendStringInfo(
- &tbstr, "\n PL/Python anonymous code block, line %ld, in %s",
+ &tbstr, "\n PL/Python anonymous code block, line %ld, in %s",
plain_lineno - 1, fname);
else
appendStringInfo(
- &tbstr, "\n PL/Python function \"%s\", line %ld, in %s",
+ &tbstr, "\n PL/Python function \"%s\", line %ld, in %s",
proname, plain_lineno - 1, fname);
/*
diff --git a/src/pl/plpython/plpy_elog.h b/src/pl/plpython/plpy_elog.h
index 6bc50fd227..e73177d130 100644
--- a/src/pl/plpython/plpy_elog.h
+++ b/src/pl/plpython/plpy_elog.h
@@ -15,7 +15,7 @@ extern void PLy_elog(int elevel, const char *fmt,...) pg_attribute_printf(2, 3);
extern void PLy_exception_set(PyObject *exc, const char *fmt,...) pg_attribute_printf(2, 3);
extern void PLy_exception_set_plural(PyObject *exc, const char *fmt_singular, const char *fmt_plural,
- unsigned long n,...) pg_attribute_printf(2, 5) pg_attribute_printf(3, 5);
+ unsigned long n,...) pg_attribute_printf(2, 5) pg_attribute_printf(3, 5);
extern void PLy_exception_set_with_details(PyObject *excclass, ErrorData *edata);
diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c
index e59d076695..c6938d00aa 100644
--- a/src/pl/plpython/plpy_exec.c
+++ b/src/pl/plpython/plpy_exec.c
@@ -376,7 +376,7 @@ PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc)
{
ereport(ERROR,
(errcode(ERRCODE_DATA_EXCEPTION),
- errmsg("unexpected return value from trigger procedure"),
+ errmsg("unexpected return value from trigger procedure"),
errdetail("Expected None or a string.")));
srv = NULL; /* keep compiler quiet */
}
@@ -402,7 +402,7 @@ PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc)
*/
ereport(ERROR,
(errcode(ERRCODE_DATA_EXCEPTION),
- errmsg("unexpected return value from trigger procedure"),
+ errmsg("unexpected return value from trigger procedure"),
errdetail("Expected None, \"OK\", \"SKIP\", or \"MODIFY\".")));
}
}
@@ -487,7 +487,7 @@ PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc)
PLy_elog(ERROR, "PyList_SetItem() failed, while setting up arguments");
if (proc->argnames && proc->argnames[i] &&
- PyDict_SetItemString(proc->globals, proc->argnames[i], arg) == -1)
+ PyDict_SetItemString(proc->globals, proc->argnames[i], arg) == -1)
PLy_elog(ERROR, "PyDict_SetItemString() failed, while setting up arguments");
arg = NULL;
}
@@ -554,7 +554,7 @@ PLy_function_save_args(PLyProcedure *proc)
if (proc->argnames[i])
{
result->namedargs[i] = PyDict_GetItemString(proc->globals,
- proc->argnames[i]);
+ proc->argnames[i]);
Py_XINCREF(result->namedargs[i]);
}
}
@@ -747,7 +747,7 @@ PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc, HeapTuple *r
Py_DECREF(pltname);
stroid = DatumGetCString(DirectFunctionCall1(oidout,
- ObjectIdGetDatum(tdata->tg_relation->rd_id)));
+ ObjectIdGetDatum(tdata->tg_relation->rd_id)));
pltrelid = PyString_FromString(stroid);
PyDict_SetItemString(pltdata, "relid", pltrelid);
Py_DECREF(pltrelid);
diff --git a/src/pl/plpython/plpy_plpymodule.c b/src/pl/plpython/plpy_plpymodule.c
index 619c471903..feaf203256 100644
--- a/src/pl/plpython/plpy_plpymodule.c
+++ b/src/pl/plpython/plpy_plpymodule.c
@@ -493,7 +493,7 @@ PLy_output(volatile int level, PyObject *self, PyObject *args, PyObject *kw)
else
{
PLy_exception_set(PyExc_TypeError,
- "'%s' is an invalid keyword argument for this function",
+ "'%s' is an invalid keyword argument for this function",
keyword);
return NULL;
}
@@ -549,7 +549,7 @@ PLy_output(volatile int level, PyObject *self, PyObject *args, PyObject *kw)
(column_name != NULL) ?
err_generic_string(PG_DIAG_COLUMN_NAME, column_name) : 0,
(constraint_name != NULL) ?
- err_generic_string(PG_DIAG_CONSTRAINT_NAME, constraint_name) : 0,
+ err_generic_string(PG_DIAG_CONSTRAINT_NAME, constraint_name) : 0,
(datatype_name != NULL) ?
err_generic_string(PG_DIAG_DATATYPE_NAME, datatype_name) : 0,
(table_name != NULL) ?
diff --git a/src/pl/plpython/plpy_procedure.c b/src/pl/plpython/plpy_procedure.c
index e86117c837..26acc88b27 100644
--- a/src/pl/plpython/plpy_procedure.c
+++ b/src/pl/plpython/plpy_procedure.c
@@ -215,7 +215,7 @@ PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is_trigger)
Form_pg_type rvTypeStruct;
rvTypeTup = SearchSysCache1(TYPEOID,
- ObjectIdGetDatum(procStruct->prorettype));
+ ObjectIdGetDatum(procStruct->prorettype));
if (!HeapTupleIsValid(rvTypeTup))
elog(ERROR, "cache lookup failed for type %u",
procStruct->prorettype);
@@ -232,8 +232,8 @@ PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is_trigger)
procStruct->prorettype != RECORDOID)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("PL/Python functions cannot return type %s",
- format_type_be(procStruct->prorettype))));
+ errmsg("PL/Python functions cannot return type %s",
+ format_type_be(procStruct->prorettype))));
}
if (rvTypeStruct->typtype == TYPTYPE_COMPOSITE ||
@@ -313,8 +313,8 @@ PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is_trigger)
/* Disallow pseudotype argument */
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("PL/Python functions cannot accept type %s",
- format_type_be(types[i]))));
+ errmsg("PL/Python functions cannot accept type %s",
+ format_type_be(types[i]))));
break;
case TYPTYPE_COMPOSITE:
/* we'll set IO funcs at first call */
diff --git a/src/pl/plpython/plpy_spi.c b/src/pl/plpython/plpy_spi.c
index c6856ccbac..955769c5e3 100644
--- a/src/pl/plpython/plpy_spi.c
+++ b/src/pl/plpython/plpy_spi.c
@@ -56,7 +56,7 @@ PLy_spi_prepare(PyObject *self, PyObject *args)
if (list && (!PySequence_Check(list)))
{
PLy_exception_set(PyExc_TypeError,
- "second argument of plpy.prepare must be a sequence");
+ "second argument of plpy.prepare must be a sequence");
return NULL;
}
@@ -226,8 +226,8 @@ PLy_spi_execute_plan(PyObject *ob, PyObject *list, long limit)
PLy_elog(ERROR, "could not execute plan");
sv = PyString_AsString(so);
PLy_exception_set_plural(PyExc_TypeError,
- "Expected sequence of %d argument, got %d: %s",
- "Expected sequence of %d arguments, got %d: %s",
+ "Expected sequence of %d argument, got %d: %s",
+ "Expected sequence of %d arguments, got %d: %s",
plan->nargs,
plan->nargs, nargs, sv);
Py_DECREF(so);
@@ -570,7 +570,7 @@ PLy_spi_exception_set(PyObject *excclass, ErrorData *edata)
spidata = Py_BuildValue("(izzzizzzzz)", edata->sqlerrcode, edata->detail, edata->hint,
edata->internalquery, edata->internalpos,
- edata->schema_name, edata->table_name, edata->column_name,
+ edata->schema_name, edata->table_name, edata->column_name,
edata->datatype_name, edata->constraint_name);
if (!spidata)
goto failure;
diff --git a/src/pl/plpython/plpy_typeio.c b/src/pl/plpython/plpy_typeio.c
index 0e04753fa1..b2db8940a0 100644
--- a/src/pl/plpython/plpy_typeio.c
+++ b/src/pl/plpython/plpy_typeio.c
@@ -683,7 +683,7 @@ PLyList_FromArray_recurse(PLyDatumToOb *elm, int *dims, int ndim, int dim,
PyObject *sublist;
sublist = PLyList_FromArray_recurse(elm, dims, ndim, dim + 1,
- dataptr_p, bitmap_p, bitmask_p);
+ dataptr_p, bitmap_p, bitmask_p);
PyList_SET_ITEM(list, i, sublist);
}
}