summaryrefslogtreecommitdiff
path: root/src/pl/plpgsql
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2014-05-06 12:12:18 -0400
committerBruce Momjian <bruce@momjian.us>2014-05-06 12:12:18 -0400
commit0a7832005792fa6dad171f9cadb8d587fe0dd800 (patch)
tree365cfc42c521a52607e41394b08ef44d338d8fc1 /src/pl/plpgsql
parentfb85cd4320414c3f6e9c8bc69ec944200ae1e493 (diff)
downloadpostgresql-0a7832005792fa6dad171f9cadb8d587fe0dd800.tar.gz
pgindent run for 9.4
This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
Diffstat (limited to 'src/pl/plpgsql')
-rw-r--r--src/pl/plpgsql/src/pl_comp.c24
-rw-r--r--src/pl/plpgsql/src/pl_exec.c66
-rw-r--r--src/pl/plpgsql/src/pl_funcs.c4
-rw-r--r--src/pl/plpgsql/src/pl_handler.c6
-rw-r--r--src/pl/plpgsql/src/pl_scanner.c8
-rw-r--r--src/pl/plpgsql/src/plpgsql.h12
6 files changed, 63 insertions, 57 deletions
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index 12ac964d13..d2fd685c35 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -288,7 +288,7 @@ do_compile(FunctionCallInfo fcinfo,
MemoryContext func_cxt;
/*
- * Setup the scanner input and error info. We assume that this function
+ * Setup the scanner input and error info. We assume that this function
* cannot be invoked recursively, so there's no need to save and restore
* the static variables used here.
*/
@@ -388,7 +388,7 @@ do_compile(FunctionCallInfo fcinfo,
* needed permanently, so make them in tmp cxt.
*
* We also need to resolve any polymorphic input or output
- * argument types. In validation mode we won't be able to, so we
+ * argument types. In validation mode we won't be able to, so we
* arbitrarily assume we are dealing with integers.
*/
MemoryContextSwitchTo(compile_tmp_cxt);
@@ -471,7 +471,7 @@ do_compile(FunctionCallInfo fcinfo,
/*
* If there's just one OUT parameter, out_param_varno points
- * directly to it. If there's more than one, build a row that
+ * directly to it. If there's more than one, build a row that
* holds all of them.
*/
if (num_out_args == 1)
@@ -810,7 +810,7 @@ plpgsql_compile_inline(char *proc_source)
int i;
/*
- * Setup the scanner input and error info. We assume that this function
+ * Setup the scanner input and error info. We assume that this function
* cannot be invoked recursively, so there's no need to save and restore
* the static variables used here.
*/
@@ -852,7 +852,11 @@ plpgsql_compile_inline(char *proc_source)
function->out_param_varno = -1; /* set up for no OUT param */
function->resolve_option = plpgsql_variable_conflict;
function->print_strict_params = plpgsql_print_strict_params;
- /* don't do extra validation for inline code as we don't want to add spam at runtime */
+
+ /*
+ * don't do extra validation for inline code as we don't want to add spam
+ * at runtime
+ */
function->extra_warnings = 0;
function->extra_errors = 0;
@@ -1070,7 +1074,7 @@ plpgsql_post_column_ref(ParseState *pstate, ColumnRef *cref, Node *var)
/*
* If we find a record/row variable but can't match a field name, throw
- * error if there was no core resolution for the ColumnRef either. In
+ * error if there was no core resolution for the ColumnRef either. In
* that situation, the reference is inevitably going to fail, and
* complaining about the record/row variable is likely to be more on-point
* than the core parser's error message. (It's too bad we don't have
@@ -1264,7 +1268,7 @@ resolve_column_ref(ParseState *pstate, PLpgSQL_expr *expr,
/*
* We should not get here, because a RECFIELD datum should
* have been built at parse time for every possible qualified
- * reference to fields of this record. But if we do, handle
+ * reference to fields of this record. But if we do, handle
* it like field-not-found: throw error or return NULL.
*/
if (error_if_no_field)
@@ -1871,7 +1875,7 @@ plpgsql_parse_cwordrowtype(List *idents)
*
* The returned struct may be a PLpgSQL_var, PLpgSQL_row, or
* PLpgSQL_rec depending on the given datatype, and is allocated via
- * palloc. The struct is automatically added to the current datum
+ * palloc. The struct is automatically added to the current datum
* array, and optionally to the current namespace.
*/
PLpgSQL_variable *
@@ -2325,7 +2329,7 @@ plpgsql_adddatum(PLpgSQL_datum *new)
* last call.
*
* This is used around a DECLARE section to create a list of the VARs
- * that have to be initialized at block entry. Note that VARs can also
+ * that have to be initialized at block entry. Note that VARs can also
* be created elsewhere than DECLARE, eg by a FOR-loop, but it is then
* the responsibility of special-purpose code to initialize them.
* ----------
@@ -2482,7 +2486,7 @@ plpgsql_resolve_polymorphic_argtypes(int numargs,
* delete_function - clean up as much as possible of a stale function cache
*
* We can't release the PLpgSQL_function struct itself, because of the
- * possibility that there are fn_extra pointers to it. We can release
+ * possibility that there are fn_extra pointers to it. We can release
* the subsidiary storage, but only if there are no active evaluations
* in progress. Otherwise we'll just leak that storage. Since the
* case would only occur if a pg_proc update is detected during a nested
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 5d5439948b..69d1965253 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -56,7 +56,7 @@ typedef struct
* creates its own "eval_econtext" ExprContext within this estate for
* per-evaluation workspace. eval_econtext is freed at normal function exit,
* and the EState is freed at transaction end (in case of error, we assume
- * that the abort mechanisms clean it all up). Furthermore, any exception
+ * that the abort mechanisms clean it all up). Furthermore, any exception
* block within a function has to have its own eval_econtext separate from
* the containing function's, so that we can clean up ExprContext callbacks
* properly at subtransaction exit. We maintain a stack that tracks the
@@ -64,7 +64,7 @@ typedef struct
*
* This arrangement is a bit tedious to maintain, but it's worth the trouble
* so that we don't have to re-prepare simple expressions on each trip through
- * a function. (We assume the case to optimize is many repetitions of a
+ * a function. (We assume the case to optimize is many repetitions of a
* function within a transaction.)
*
* However, there's no value in trying to amortize simple expression setup
@@ -232,9 +232,9 @@ static Portal exec_dynquery_with_params(PLpgSQL_execstate *estate,
const char *portalname, int cursorOptions);
static char *format_expr_params(PLpgSQL_execstate *estate,
- const PLpgSQL_expr *expr);
+ const PLpgSQL_expr *expr);
static char *format_preparedparamsdata(PLpgSQL_execstate *estate,
- const PreparedParamsData *ppd);
+ const PreparedParamsData *ppd);
/* ----------
@@ -543,7 +543,7 @@ plpgsql_exec_trigger(PLpgSQL_function *func,
*
* We make the tupdescs available in both records even though only one may
* have a value. This allows parsing of record references to succeed in
- * functions that are used for multiple trigger types. For example, we
+ * functions that are used for multiple trigger types. For example, we
* might have a test like "if (TG_OP = 'INSERT' and NEW.foo = 'xyz')",
* which should parse regardless of the current trigger type.
*/
@@ -1226,7 +1226,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
SPI_restore_connection();
/*
- * Must clean up the econtext too. However, any tuple table made
+ * Must clean up the econtext too. However, any tuple table made
* in the subxact will have been thrown away by SPI during subxact
* abort, so we don't need to (and mustn't try to) free the
* eval_tuptable.
@@ -1630,7 +1630,7 @@ exec_stmt_getdiag(PLpgSQL_execstate *estate, PLpgSQL_stmt_getdiag *stmt)
case PLPGSQL_GETDIAG_CONTEXT:
{
- char *contextstackstr = GetErrorContextStack();
+ char *contextstackstr = GetErrorContextStack();
exec_assign_c_string(estate, var, contextstackstr);
@@ -3335,7 +3335,7 @@ exec_stmt_execsql(PLpgSQL_execstate *estate,
/*
* Check for error, and set FOUND if appropriate (for historical reasons
- * we set FOUND only for certain query types). Also Assert that we
+ * we set FOUND only for certain query types). Also Assert that we
* identified the statement type the same as SPI did.
*/
switch (rc)
@@ -3422,7 +3422,7 @@ exec_stmt_execsql(PLpgSQL_execstate *estate,
{
if (stmt->strict)
{
- char *errdetail;
+ char *errdetail;
if (estate->func->print_strict_params)
errdetail = format_expr_params(estate, expr);
@@ -3441,7 +3441,7 @@ exec_stmt_execsql(PLpgSQL_execstate *estate,
{
if (n > 1 && (stmt->strict || stmt->mod_stmt))
{
- char *errdetail;
+ char *errdetail;
if (estate->func->print_strict_params)
errdetail = format_expr_params(estate, expr);
@@ -3614,7 +3614,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
{
if (stmt->strict)
{
- char *errdetail;
+ char *errdetail;
if (estate->func->print_strict_params)
errdetail = format_preparedparamsdata(estate, ppd);
@@ -3633,7 +3633,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
{
if (n > 1 && stmt->strict)
{
- char *errdetail;
+ char *errdetail;
if (estate->func->print_strict_params)
errdetail = format_preparedparamsdata(estate, ppd);
@@ -4073,7 +4073,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
var->datatype->typlen);
/*
- * Now free the old value. (We can't do this any earlier
+ * Now free the old value. (We can't do this any earlier
* because of the possibility that we are assigning the var's
* old value to it, eg "foo := foo". We could optimize out
* the assignment altogether in such cases, but it's too
@@ -4433,7 +4433,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
* At present this doesn't handle PLpgSQL_expr or PLpgSQL_arrayelem datums.
*
* NOTE: caller must not modify the returned value, since it points right
- * at the stored value in the case of pass-by-reference datatypes. In some
+ * at the stored value in the case of pass-by-reference datatypes. In some
* cases we have to palloc a return value, and in such cases we put it into
* the estate's short-term memory context.
*/
@@ -4942,7 +4942,7 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt,
PinPortal(portal);
/*
- * Fetch the initial tuple(s). If prefetching is allowed then we grab a
+ * Fetch the initial tuple(s). If prefetching is allowed then we grab a
* few more rows to avoid multiple trips through executor startup
* overhead.
*/
@@ -5080,7 +5080,7 @@ loop_exit:
* Because we only store one execution tree for a simple expression, we
* can't handle recursion cases. So, if we see the tree is already busy
* with an evaluation in the current xact, we just return FALSE and let the
- * caller run the expression the hard way. (Other alternatives such as
+ * caller run the expression the hard way. (Other alternatives such as
* creating a new tree for a recursive call either introduce memory leaks,
* or add enough bookkeeping to be doubtful wins anyway.) Another case that
* is covered by the expr_simple_in_use test is where a previous execution
@@ -5308,7 +5308,7 @@ setup_param_list(PLpgSQL_execstate *estate, PLpgSQL_expr *expr)
estate->cur_expr = expr;
/*
- * Also make sure this is set before parser hooks need it. There is
+ * Also make sure this is set before parser hooks need it. There is
* no need to save and restore, since the value is always correct once
* set. (Should be set already, but let's be sure.)
*/
@@ -5350,7 +5350,7 @@ plpgsql_param_fetch(ParamListInfo params, int paramid)
/*
* Do nothing if asked for a value that's not supposed to be used by this
- * SQL expression. This avoids unwanted evaluations when functions such
+ * SQL expression. This avoids unwanted evaluations when functions such
* as copyParamList try to materialize all the values.
*/
if (!bms_is_member(dno, expr->paramnos))
@@ -5684,7 +5684,7 @@ convert_value_to_string(PLpgSQL_execstate *estate, Datum value, Oid valtype)
*
* Note: the estate's eval_econtext is used for temporary storage, and may
* also contain the result Datum if we have to do a conversion to a pass-
- * by-reference data type. Be sure to do an exec_eval_cleanup() call when
+ * by-reference data type. Be sure to do an exec_eval_cleanup() call when
* done with the result.
* ----------
*/
@@ -6216,7 +6216,7 @@ plpgsql_create_econtext(PLpgSQL_execstate *estate)
/*
* Create an EState for evaluation of simple expressions, if there's not
- * one already in the current transaction. The EState is made a child of
+ * one already in the current transaction. The EState is made a child of
* TopTransactionContext so it will have the right lifespan.
*
* Note that this path is never taken when executing a DO block; the
@@ -6531,10 +6531,10 @@ static char *
format_expr_params(PLpgSQL_execstate *estate,
const PLpgSQL_expr *expr)
{
- int paramno;
- int dno;
+ int paramno;
+ int dno;
StringInfoData paramstr;
- Bitmapset *tmpset;
+ Bitmapset *tmpset;
if (!expr->paramnos)
return NULL;
@@ -6544,10 +6544,10 @@ format_expr_params(PLpgSQL_execstate *estate,
paramno = 0;
while ((dno = bms_first_member(tmpset)) >= 0)
{
- Datum paramdatum;
- Oid paramtypeid;
- bool paramisnull;
- int32 paramtypmod;
+ Datum paramdatum;
+ Oid paramtypeid;
+ bool paramisnull;
+ int32 paramtypmod;
PLpgSQL_var *curvar;
curvar = (PLpgSQL_var *) estate->datums[dno];
@@ -6563,8 +6563,9 @@ format_expr_params(PLpgSQL_execstate *estate,
appendStringInfoString(&paramstr, "NULL");
else
{
- char *value = convert_value_to_string(estate, paramdatum, paramtypeid);
- char *p;
+ char *value = convert_value_to_string(estate, paramdatum, paramtypeid);
+ char *p;
+
appendStringInfoCharMacro(&paramstr, '\'');
for (p = value; *p; p++)
{
@@ -6590,7 +6591,7 @@ static char *
format_preparedparamsdata(PLpgSQL_execstate *estate,
const PreparedParamsData *ppd)
{
- int paramno;
+ int paramno;
StringInfoData paramstr;
if (!ppd)
@@ -6607,8 +6608,9 @@ format_preparedparamsdata(PLpgSQL_execstate *estate,
appendStringInfoString(&paramstr, "NULL");
else
{
- char *value = convert_value_to_string(estate, ppd->values[paramno], ppd->types[paramno]);
- char *p;
+ char *value = convert_value_to_string(estate, ppd->values[paramno], ppd->types[paramno]);
+ char *p;
+
appendStringInfoCharMacro(&paramstr, '\'');
for (p = value; *p; p++)
{
diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c
index 430232c687..d6825e4634 100644
--- a/src/pl/plpgsql/src/pl_funcs.c
+++ b/src/pl/plpgsql/src/pl_funcs.c
@@ -25,7 +25,7 @@
* list or "chain" (from the youngest item to the root) is accessible from
* any one plpgsql statement. During initial parsing of a function, ns_top
* points to the youngest item accessible from the block currently being
- * parsed. We store the entire tree, however, since at runtime we will need
+ * parsed. We store the entire tree, however, since at runtime we will need
* to access the chain that's relevant to any one statement.
*
* Block boundaries in the namespace chain are marked by PLPGSQL_NSTYPE_LABEL
@@ -113,7 +113,7 @@ plpgsql_ns_additem(int itemtype, int itemno, const char *name)
*
* If localmode is TRUE, only the topmost block level is searched.
*
- * name1 must be non-NULL. Pass NULL for name2 and/or name3 if parsing a name
+ * name1 must be non-NULL. Pass NULL for name2 and/or name3 if parsing a name
* with fewer than three components.
*
* If names_used isn't NULL, *names_used receives the number of names
diff --git a/src/pl/plpgsql/src/pl_handler.c b/src/pl/plpgsql/src/pl_handler.c
index e659f8e289..e3e350c0f8 100644
--- a/src/pl/plpgsql/src/pl_handler.c
+++ b/src/pl/plpgsql/src/pl_handler.c
@@ -44,8 +44,8 @@ int plpgsql_variable_conflict = PLPGSQL_RESOLVE_ERROR;
bool plpgsql_print_strict_params = false;
-char *plpgsql_extra_warnings_string = NULL;
-char *plpgsql_extra_errors_string = NULL;
+char *plpgsql_extra_warnings_string = NULL;
+char *plpgsql_extra_errors_string = NULL;
int plpgsql_extra_warnings;
int plpgsql_extra_errors;
@@ -59,7 +59,7 @@ plpgsql_extra_checks_check_hook(char **newvalue, void **extra, GucSource source)
char *rawstring;
List *elemlist;
ListCell *l;
- int extrachecks = 0;
+ int extrachecks = 0;
int *myextra;
if (pg_strcasecmp(*newvalue, "all") == 0)
diff --git a/src/pl/plpgsql/src/pl_scanner.c b/src/pl/plpgsql/src/pl_scanner.c
index 19d96b75fc..6a5a04bc0c 100644
--- a/src/pl/plpgsql/src/pl_scanner.c
+++ b/src/pl/plpgsql/src/pl_scanner.c
@@ -44,7 +44,7 @@ IdentifierLookup plpgsql_IdentifierLookup = IDENTIFIER_LOOKUP_NORMAL;
*
* For the most part, the reserved keywords are those that start a PL/pgSQL
* statement (and so would conflict with an assignment to a variable of the
- * same name). We also don't sweat it much about reserving keywords that
+ * same name). We also don't sweat it much about reserving keywords that
* are reserved in the core grammar. Try to avoid reserving other words.
*/
@@ -177,7 +177,7 @@ typedef struct
/*
* Scanner working state. At some point we might wish to fold all this
- * into a YY_EXTRA struct. For the moment, there is no need for plpgsql's
+ * into a YY_EXTRA struct. For the moment, there is no need for plpgsql's
* lexer to be re-entrant, and the notational burden of passing a yyscanner
* pointer around is great enough to not want to do it without need.
*/
@@ -345,7 +345,7 @@ plpgsql_yylex(void)
/*
* Internal yylex function. This wraps the core lexer and adds one feature:
- * a token pushback stack. We also make a couple of trivial single-token
+ * a token pushback stack. We also make a couple of trivial single-token
* translations from what the core lexer does to what we want, in particular
* interfacing from the core_YYSTYPE to YYSTYPE union.
*/
@@ -559,7 +559,7 @@ plpgsql_yyerror(const char *message)
/*
* If we have done any lookahead then flex will have restored the
* character after the end-of-token. Zap it again so that we report
- * only the single token here. This modifies scanbuf but we no longer
+ * only the single token here. This modifies scanbuf but we no longer
* care about that.
*/
yytext[plpgsql_yyleng] = '\0';
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index b4d1498e43..d6f31ffc63 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -668,7 +668,7 @@ typedef struct PLpgSQL_func_hashkey
/*
* For a trigger function, the OID of the relation triggered on is part of
* the hash key --- we want to compile the trigger separately for each
- * relation it is used with, in case the rowtype is different. Zero if
+ * relation it is used with, in case the rowtype is different. Zero if
* not called as a trigger.
*/
Oid trigrelOid;
@@ -740,8 +740,8 @@ typedef struct PLpgSQL_function
bool print_strict_params;
/* extra checks */
- int extra_warnings;
- int extra_errors;
+ int extra_warnings;
+ int extra_errors;
int ndatums;
PLpgSQL_datum **datums;
@@ -827,7 +827,7 @@ typedef struct PLpgSQL_execstate
*
* Also, immediately before any call to func_setup, PL/pgSQL fills in the
* error_callback and assign_expr fields with pointers to its own
- * plpgsql_exec_error_callback and exec_assign_expr functions. This is
+ * plpgsql_exec_error_callback and exec_assign_expr functions. This is
* a somewhat ad-hoc expedient to simplify life for debugger plugins.
*/
@@ -890,8 +890,8 @@ extern bool plpgsql_print_strict_params;
#define PLPGSQL_XCHECK_SHADOWVAR 1
#define PLPGSQL_XCHECK_ALL ((int) ~0)
-extern int plpgsql_extra_warnings;
-extern int plpgsql_extra_errors;
+extern int plpgsql_extra_warnings;
+extern int plpgsql_extra_errors;
extern bool plpgsql_check_syntax;
extern bool plpgsql_DumpExecTree;