summaryrefslogtreecommitdiff
path: root/src/pl
diff options
context:
space:
mode:
authorBruce Momjian2007-11-15 21:14:46 +0000
committerBruce Momjian2007-11-15 21:14:46 +0000
commitfdf5a5efb7b28c13085fe7313658de8d7b9914f6 (patch)
treea75cf1422fa1eef4e801cf502b148d8ce1b5dfe7 /src/pl
parent3adc760fb92eab1a8720337a8bf9b66486609eb3 (diff)
pgindent run for 8.3.
Diffstat (limited to 'src/pl')
-rw-r--r--src/pl/plperl/plperl.c73
-rw-r--r--src/pl/plpgsql/src/pl_comp.c15
-rw-r--r--src/pl/plpgsql/src/pl_exec.c98
-rw-r--r--src/pl/plpgsql/src/pl_funcs.c13
-rw-r--r--src/pl/plpgsql/src/plpgsql.h14
-rw-r--r--src/pl/plpython/plpython.c55
-rw-r--r--src/pl/tcl/pltcl.c28
7 files changed, 151 insertions, 145 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index b3df4dbc061..63996f31e54 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -1,7 +1,7 @@
/**********************************************************************
* plperl.c - perl as a procedural language for PostgreSQL
*
- * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.130 2007/10/05 17:06:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.131 2007/11/15 21:14:46 momjian Exp $
*
**********************************************************************/
@@ -60,9 +60,10 @@ typedef struct plperl_proc_desc
typedef struct plperl_proc_entry
{
- char proc_name[NAMEDATALEN]; /* internal name, eg __PLPerl_proc_39987 */
+ char proc_name[NAMEDATALEN]; /* internal name, eg
+ * __PLPerl_proc_39987 */
plperl_proc_desc *proc_data;
-} plperl_proc_entry;
+} plperl_proc_entry;
/*
* The information we cache for the duration of a single call to a
@@ -91,13 +92,13 @@ typedef struct plperl_query_desc
Oid *argtypioparams;
} plperl_query_desc;
-/* hash table entry for query desc */
+/* hash table entry for query desc */
typedef struct plperl_query_entry
{
- char query_name[NAMEDATALEN];
+ char query_name[NAMEDATALEN];
plperl_query_desc *query_data;
-} plperl_query_entry;
+} plperl_query_entry;
/**********************************************************************
* Global data
@@ -110,7 +111,7 @@ typedef enum
INTERP_TRUSTED,
INTERP_UNTRUSTED,
INTERP_BOTH
-} InterpState;
+} InterpState;
static InterpState interp_state = INTERP_NONE;
static bool can_run_two = false;
@@ -120,8 +121,8 @@ static PerlInterpreter *plperl_trusted_interp = NULL;
static PerlInterpreter *plperl_untrusted_interp = NULL;
static PerlInterpreter *plperl_held_interp = NULL;
static bool trusted_context;
-static HTAB *plperl_proc_hash = NULL;
-static HTAB *plperl_query_hash = NULL;
+static HTAB *plperl_proc_hash = NULL;
+static HTAB *plperl_query_hash = NULL;
static bool plperl_use_strict = false;
@@ -177,7 +178,7 @@ _PG_init(void)
{
/* Be sure we do initialization only once (should be redundant now) */
static bool inited = false;
- HASHCTL hash_ctl;
+ HASHCTL hash_ctl;
if (inited)
return;
@@ -287,8 +288,8 @@ _PG_init(void)
#define TEST_FOR_MULTI \
"use Config; " \
- "$Config{usemultiplicity} eq 'define' or " \
- "($Config{usethreads} eq 'define' " \
+ "$Config{usemultiplicity} eq 'define' or " \
+ "($Config{usethreads} eq 'define' " \
" and $Config{useithreads} eq 'define')"
@@ -356,7 +357,7 @@ check_interp(bool trusted)
static void
-restore_context (bool old_context)
+restore_context(bool old_context)
{
if (trusted_context != old_context)
{
@@ -429,9 +430,9 @@ plperl_init_interp(void)
if (interp_state == INTERP_NONE)
{
- SV *res;
+ SV *res;
- res = eval_pv(TEST_FOR_MULTI,TRUE);
+ res = eval_pv(TEST_FOR_MULTI, TRUE);
can_run_two = SvIV(res);
interp_state = INTERP_HELD;
}
@@ -1152,7 +1153,7 @@ plperl_func_handler(PG_FUNCTION_ARGS)
Datum retval;
ReturnSetInfo *rsi;
SV *array_ret = NULL;
- bool oldcontext = trusted_context;
+ bool oldcontext = trusted_context;
/*
* Create the call_data beforing connecting to SPI, so that it is not
@@ -1307,7 +1308,7 @@ plperl_trigger_handler(PG_FUNCTION_ARGS)
Datum retval;
SV *svTD;
HV *hvTD;
- bool oldcontext = trusted_context;
+ bool oldcontext = trusted_context;
/*
* Create the call_data beforing connecting to SPI, so that it is not
@@ -1410,8 +1411,8 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
plperl_proc_desc *prodesc = NULL;
int i;
plperl_proc_entry *hash_entry;
- bool found;
- bool oldcontext = trusted_context;
+ bool found;
+ bool oldcontext = trusted_context;
/* We'll need the pg_proc tuple in any case... */
procTup = SearchSysCache(PROCOID,
@@ -1447,7 +1448,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
* function's pg_proc entry without changing its OID.
************************************************************/
uptodate = (prodesc->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) &&
- ItemPointerEquals(&prodesc->fn_tid, &procTup->t_self));
+ ItemPointerEquals(&prodesc->fn_tid, &procTup->t_self));
if (!uptodate)
{
@@ -1558,7 +1559,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
prodesc->result_oid = procStruct->prorettype;
prodesc->fn_retisset = procStruct->proretset;
prodesc->fn_retistuple = (procStruct->prorettype == RECORDOID ||
- typeStruct->typtype == TYPTYPE_COMPOSITE);
+ typeStruct->typtype == TYPTYPE_COMPOSITE);
prodesc->fn_retisarray =
(typeStruct->typlen == -1 && typeStruct->typelem);
@@ -2109,7 +2110,7 @@ plperl_spi_prepare(char *query, int argc, SV **argv)
{
plperl_query_desc *qdesc;
plperl_query_entry *hash_entry;
- bool found;
+ bool found;
void *plan;
int i;
@@ -2139,8 +2140,10 @@ plperl_spi_prepare(char *query, int argc, SV **argv)
************************************************************/
for (i = 0; i < argc; i++)
{
- Oid typId, typInput, typIOParam;
- int32 typmod;
+ Oid typId,
+ typInput,
+ typIOParam;
+ int32 typmod;
parseTypeString(SvPV(argv[i], PL_na), &typId, &typmod);
@@ -2223,7 +2226,7 @@ plperl_spi_prepare(char *query, int argc, SV **argv)
************************************************************/
hash_entry = hash_search(plperl_query_hash, qdesc->qname,
- HASH_ENTER,&found);
+ HASH_ENTER, &found);
hash_entry->query_data = qdesc;
return newSVstring(qdesc->qname);
@@ -2260,7 +2263,7 @@ plperl_spi_exec_prepared(char *query, HV *attr, int argc, SV **argv)
************************************************************/
hash_entry = hash_search(plperl_query_hash, query,
- HASH_FIND,NULL);
+ HASH_FIND, NULL);
if (hash_entry == NULL)
elog(ERROR, "spi_exec_prepared: Invalid prepared query passed");
@@ -2401,7 +2404,7 @@ plperl_spi_query_prepared(char *query, int argc, SV **argv)
* Fetch the saved plan descriptor, see if it's o.k.
************************************************************/
hash_entry = hash_search(plperl_query_hash, query,
- HASH_FIND,NULL);
+ HASH_FIND, NULL);
if (hash_entry == NULL)
elog(ERROR, "spi_exec_prepared: Invalid prepared query passed");
@@ -2515,7 +2518,7 @@ plperl_spi_freeplan(char *query)
plperl_query_entry *hash_entry;
hash_entry = hash_search(plperl_query_hash, query,
- HASH_FIND,NULL);
+ HASH_FIND, NULL);
if (hash_entry == NULL)
elog(ERROR, "spi_exec_prepared: Invalid prepared query passed");
@@ -2544,7 +2547,7 @@ plperl_spi_freeplan(char *query)
* Create a new SV from a string assumed to be in the current database's
* encoding.
*/
-static SV *
+static SV *
newSVstring(const char *str)
{
SV *sv;
@@ -2564,13 +2567,13 @@ newSVstring(const char *str)
static SV **
hv_store_string(HV *hv, const char *key, SV *val)
{
- int32 klen = strlen(key);
+ int32 klen = strlen(key);
/*
- * This seems nowhere documented, but under Perl 5.8.0 and up,
- * hv_store() recognizes a negative klen parameter as meaning
- * a UTF-8 encoded key. It does not appear that hashes track
- * UTF-8-ness of keys at all in Perl 5.6.
+ * This seems nowhere documented, but under Perl 5.8.0 and up, hv_store()
+ * recognizes a negative klen parameter as meaning a UTF-8 encoded key.
+ * It does not appear that hashes track UTF-8-ness of keys at all in Perl
+ * 5.6.
*/
#if PERL_BCDVERSION >= 0x5008000L
if (GetDatabaseEncoding() == PG_UTF8)
@@ -2586,7 +2589,7 @@ hv_store_string(HV *hv, const char *key, SV *val)
static SV **
hv_fetch_string(HV *hv, const char *key)
{
- int32 klen = strlen(key);
+ int32 klen = strlen(key);
/* See notes in hv_store_string */
#if PERL_BCDVERSION >= 0x5008000L
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index 7799cf7c656..edb423e5215 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.118 2007/11/11 19:22:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.119 2007/11/15 21:14:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -174,6 +174,7 @@ recheck:
* storage (if not done already).
*/
delete_function(function);
+
/*
* If the function isn't in active use then we can overwrite the
* func struct with new data, allowing any other existing fn_extra
@@ -185,8 +186,8 @@ recheck:
* what a corner case this is.)
*
* If we found the function struct via fn_extra then it's possible
- * a replacement has already been made, so go back and recheck
- * the hashtable.
+ * a replacement has already been made, so go back and recheck the
+ * hashtable.
*/
if (function->use_count != 0)
{
@@ -482,7 +483,7 @@ do_compile(FunctionCallInfo fcinfo,
{
if (rettypeid == ANYARRAYOID)
rettypeid = INT4ARRAYOID;
- else /* ANYELEMENT or ANYNONARRAY */
+ else /* ANYELEMENT or ANYNONARRAY */
rettypeid = INT4OID;
/* XXX what could we use for ANYENUM? */
}
@@ -1890,7 +1891,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.
* ----------
@@ -2021,7 +2022,7 @@ plpgsql_resolve_polymorphic_argtypes(int numargs,
{
case ANYELEMENTOID:
case ANYNONARRAYOID:
- case ANYENUMOID: /* XXX dubious */
+ case ANYENUMOID: /* XXX dubious */
argtypes[i] = INT4OID;
break;
case ANYARRAYOID:
@@ -2038,7 +2039,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 dd415047f3e..d06fe494f15 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.199 2007/07/25 04:19:08 neilc Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.200 2007/11/15 21:14:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,24 +43,24 @@ static const char *const raise_skip_msg = "RAISE";
* 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). In order to be sure
+ * that the abort mechanisms clean it all up). In order to be sure
* ExprContext callbacks are handled properly, each subtransaction has to have
- * its own such EState; hence we need a stack. We use a simple counter to
+ * its own such EState; hence we need a stack. We use a simple counter to
* distinguish different instantiations of the EState, so that we can tell
* whether we have a current copy of a prepared expression.
*
* 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.)
*/
typedef struct SimpleEstateStackEntry
{
- EState *xact_eval_estate; /* EState for current xact level */
- long int xact_estate_simple_id; /* ID for xact_eval_estate */
- SubTransactionId xact_subxid; /* ID for current subxact */
- struct SimpleEstateStackEntry *next; /* next stack entry up */
-} SimpleEstateStackEntry;
+ EState *xact_eval_estate; /* EState for current xact level */
+ long int xact_estate_simple_id; /* ID for xact_eval_estate */
+ SubTransactionId xact_subxid; /* ID for current subxact */
+ struct SimpleEstateStackEntry *next; /* next stack entry up */
+} SimpleEstateStackEntry;
static SimpleEstateStackEntry *simple_estate_stack = NULL;
static long int simple_estate_id_counter = 0;
@@ -106,7 +106,7 @@ static int exec_stmt_return(PLpgSQL_execstate *estate,
static int exec_stmt_return_next(PLpgSQL_execstate *estate,
PLpgSQL_stmt_return_next *stmt);
static int exec_stmt_return_query(PLpgSQL_execstate *estate,
- PLpgSQL_stmt_return_query *stmt);
+ PLpgSQL_stmt_return_query * stmt);
static int exec_stmt_raise(PLpgSQL_execstate *estate,
PLpgSQL_stmt_raise *stmt);
static int exec_stmt_execsql(PLpgSQL_execstate *estate,
@@ -732,15 +732,15 @@ plpgsql_exec_error_callback(void *arg)
* message dictionary.
*
* If both err_text and err_stmt are set, use the err_text as
- * description, but report the err_stmt's line number. When
- * err_stmt is not set, we're in function entry/exit, or some such
- * place not attached to a specific line number.
+ * description, but report the err_stmt's line number. When err_stmt
+ * is not set, we're in function entry/exit, or some such place not
+ * attached to a specific line number.
*/
if (estate->err_stmt != NULL)
{
/*
- * translator: last %s is a phrase such as "during statement
- * block local variable initialization"
+ * translator: last %s is a phrase such as "during statement block
+ * local variable initialization"
*/
errcontext("PL/pgSQL function \"%s\" line %d %s",
estate->err_func->fn_name,
@@ -899,15 +899,15 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
{
/*
* If needed, give the datatype a chance to reject
- * NULLs, by assigning a NULL to the variable.
- * We claim the value is of type UNKNOWN, not the
- * var's datatype, else coercion will be skipped.
- * (Do this before the notnull check to be
- * consistent with exec_assign_value.)
+ * NULLs, by assigning a NULL to the variable. We
+ * claim the value is of type UNKNOWN, not the var's
+ * datatype, else coercion will be skipped. (Do this
+ * before the notnull check to be consistent with
+ * exec_assign_value.)
*/
if (!var->datatype->typinput.fn_strict)
{
- bool valIsNull = true;
+ bool valIsNull = true;
exec_assign_value(estate,
(PLpgSQL_datum *) var,
@@ -991,9 +991,9 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
/*
* If the block ended with RETURN, we may need to copy the return
- * value out of the subtransaction eval_context. This is currently
- * only needed for scalar result types --- rowtype values will
- * always exist in the function's own memory context.
+ * value out of the subtransaction eval_context. This is
+ * currently only needed for scalar result types --- rowtype
+ * values will always exist in the function's own memory context.
*/
if (rc == PLPGSQL_RC_RETURN &&
!estate->retisset &&
@@ -1590,7 +1590,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt)
if (step_value <= 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("BY value of FOR loop must be greater than zero")));
+ errmsg("BY value of FOR loop must be greater than zero")));
}
else
step_value = 1;
@@ -2151,9 +2151,9 @@ exec_stmt_return_next(PLpgSQL_execstate *estate,
*/
static int
exec_stmt_return_query(PLpgSQL_execstate *estate,
- PLpgSQL_stmt_return_query *stmt)
+ PLpgSQL_stmt_return_query * stmt)
{
- Portal portal;
+ Portal portal;
if (!estate->retisset)
ereport(ERROR,
@@ -2168,12 +2168,12 @@ exec_stmt_return_query(PLpgSQL_execstate *estate,
if (!compatible_tupdesc(estate->rettupdesc, portal->tupDesc))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("structure of query does not match function result type")));
+ errmsg("structure of query does not match function result type")));
while (true)
{
- MemoryContext old_cxt;
- int i;
+ MemoryContext old_cxt;
+ int i;
SPI_cursor_fetch(portal, true, 50);
if (SPI_processed == 0)
@@ -2182,7 +2182,8 @@ exec_stmt_return_query(PLpgSQL_execstate *estate,
old_cxt = MemoryContextSwitchTo(estate->tuple_store_cxt);
for (i = 0; i < SPI_processed; i++)
{
- HeapTuple tuple = SPI_tuptable->vals[i];
+ HeapTuple tuple = SPI_tuptable->vals[i];
+
tuplestore_puttuple(estate->tuple_store, tuple);
}
MemoryContextSwitchTo(old_cxt);
@@ -3198,7 +3199,7 @@ exec_stmt_open(PLpgSQL_execstate *estate, PLpgSQL_stmt_open *stmt)
/* ----------
* exec_stmt_fetch Fetch from a cursor into a target, or just
- * move the current position of the cursor
+ * move the current position of the cursor
* ----------
*/
static int
@@ -3234,7 +3235,7 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
/* Calculate position for FETCH_RELATIVE or FETCH_ABSOLUTE */
if (stmt->expr)
{
- bool isnull;
+ bool isnull;
/* XXX should be doing this in LONG not INT width */
how_many = exec_eval_integer(estate, stmt->expr, &isnull);
@@ -4153,11 +4154,10 @@ exec_eval_simple_expr(PLpgSQL_execstate *estate,
return false;
/*
- * Revalidate cached plan, so that we will notice if it became stale.
- * (We also need to hold a refcount while using the plan.) Note that
- * even if replanning occurs, the length of plancache_list can't change,
- * since it is a property of the raw parsetree generated from the query
- * text.
+ * Revalidate cached plan, so that we will notice if it became stale. (We
+ * also need to hold a refcount while using the plan.) Note that even if
+ * replanning occurs, the length of plancache_list can't change, since it
+ * is a property of the raw parsetree generated from the query text.
*/
Assert(list_length(expr->plan->plancache_list) == 1);
plansource = (CachedPlanSource *) linitial(expr->plan->plancache_list);
@@ -4350,13 +4350,13 @@ exec_move_row(PLpgSQL_execstate *estate,
* Row is a bit more complicated in that we assign the individual
* attributes of the tuple to the variables the row points to.
*
- * NOTE: this code used to demand row->nfields == HeapTupleHeaderGetNatts(tup->t_data,
- * but that's wrong. The tuple might have more fields than we expected if
- * it's from an inheritance-child table of the current table, or it might
- * have fewer if the table has had columns added by ALTER TABLE. Ignore
- * extra columns and assume NULL for missing columns, the same as
- * heap_getattr would do. We also have to skip over dropped columns in
- * either the source or destination.
+ * NOTE: this code used to demand row->nfields ==
+ * HeapTupleHeaderGetNatts(tup->t_data, but that's wrong. The tuple might
+ * have more fields than we expected if it's from an inheritance-child
+ * table of the current table, or it might have fewer if the table has had
+ * columns added by ALTER TABLE. Ignore extra columns and assume NULL for
+ * missing columns, the same as heap_getattr would do. We also have to
+ * skip over dropped columns in either the source or destination.
*
* If we have no tuple data at all, we'll assign NULL to all columns of
* the row variable.
@@ -4785,7 +4785,7 @@ exec_simple_check_node(Node *node)
case T_XmlExpr:
{
- XmlExpr *expr = (XmlExpr *) node;
+ XmlExpr *expr = (XmlExpr *) node;
if (!exec_simple_check_node((Node *) expr->named_args))
return FALSE;
@@ -4854,8 +4854,8 @@ exec_simple_check_plan(PLpgSQL_expr *expr)
TargetEntry *tle;
/*
- * Initialize to "not simple", and remember the plan generation number
- * we last checked. (If the query produces more or less than one parsetree
+ * Initialize to "not simple", and remember the plan generation number we
+ * last checked. (If the query produces more or less than one parsetree
* we just leave expr_simple_generation set to 0.)
*/
expr->expr_simple_expr = NULL;
@@ -5046,7 +5046,7 @@ plpgsql_subxact_cb(SubXactEvent event, SubTransactionId mySubid,
simple_estate_stack->xact_subxid == mySubid)
{
SimpleEstateStackEntry *next;
-
+
if (event == SUBXACT_EVENT_COMMIT_SUB)
FreeExecutorState(simple_estate_stack->xact_eval_estate);
next = simple_estate_stack->next;
diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c
index 55c8d2eeac7..f2cfdc0155c 100644
--- a/src/pl/plpgsql/src/pl_funcs.c
+++ b/src/pl/plpgsql/src/pl_funcs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.63 2007/07/25 04:19:08 neilc Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.64 2007/11/15 21:14:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -486,7 +486,7 @@ static void dump_fors(PLpgSQL_stmt_fors *stmt);
static void dump_exit(PLpgSQL_stmt_exit *stmt);
static void dump_return(PLpgSQL_stmt_return *stmt);
static void dump_return_next(PLpgSQL_stmt_return_next *stmt);
-static void dump_return_query(PLpgSQL_stmt_return_query *stmt);
+static void dump_return_query(PLpgSQL_stmt_return_query * stmt);
static void dump_raise(PLpgSQL_stmt_raise *stmt);
static void dump_execsql(PLpgSQL_stmt_execsql *stmt);
static void dump_dynexecute(PLpgSQL_stmt_dynexecute *stmt);
@@ -766,7 +766,7 @@ static void
dump_fetch(PLpgSQL_stmt_fetch *stmt)
{
dump_ind();
-
+
if (!stmt->is_move)
{
printf("FETCH curvar=%d\n", stmt->curvar);
@@ -814,7 +814,7 @@ dump_cursor_direction(PLpgSQL_stmt_fetch *stmt)
default:
printf("??? unknown cursor direction %d", stmt->direction);
}
-
+
if (stmt->expr)
{
dump_expr(stmt->expr);
@@ -822,7 +822,7 @@ dump_cursor_direction(PLpgSQL_stmt_fetch *stmt)
}
else
printf("%d\n", stmt->how_many);
-
+
dump_indent -= 2;
}
@@ -885,7 +885,7 @@ dump_return_next(PLpgSQL_stmt_return_next *stmt)
}
static void
-dump_return_query(PLpgSQL_stmt_return_query *stmt)
+dump_return_query(PLpgSQL_stmt_return_query * stmt)
{
dump_ind();
printf("RETURN QUERY ");
@@ -1124,4 +1124,3 @@ plpgsql_dumptree(PLpgSQL_function *func)
printf("\nEnd of execution tree of function %s\n\n", func->fn_name);
fflush(stdout);
}
-
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index 4a61379fb55..6cac7443830 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.91 2007/07/25 04:19:09 neilc Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.92 2007/11/15 21:14:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -178,12 +178,12 @@ typedef struct PLpgSQL_expr
Oid *plan_argtypes;
/* fields for "simple expression" fast-path execution: */
Expr *expr_simple_expr; /* NULL means not a simple expr */
- int expr_simple_generation; /* plancache generation we checked */
+ int expr_simple_generation; /* plancache generation we checked */
Oid expr_simple_type; /* result type Oid, if simple */
/*
* if expr is simple AND prepared in current eval_estate,
- * expr_simple_state is valid. Test validity by seeing if expr_simple_id
+ * expr_simple_state is valid. Test validity by seeing if expr_simple_id
* matches eval_estate_simple_id.
*/
ExprState *expr_simple_state;
@@ -499,7 +499,7 @@ typedef struct
int cmd_type;
int lineno;
PLpgSQL_expr *query;
-} PLpgSQL_stmt_return_query;
+} PLpgSQL_stmt_return_query;
typedef struct
{ /* RAISE statement */
@@ -631,9 +631,9 @@ typedef struct
SPITupleTable *eval_tuptable;
uint32 eval_processed;
Oid eval_lastoid;
- ExprContext *eval_econtext; /* for executing simple expressions */
+ ExprContext *eval_econtext; /* for executing simple expressions */
EState *eval_estate; /* EState containing eval_econtext */
- long int eval_estate_simple_id; /* ID for eval_estate */
+ long int eval_estate_simple_id; /* ID for eval_estate */
/* status information for error context reporting */
PLpgSQL_function *err_func; /* current func */
@@ -760,7 +760,7 @@ extern HeapTuple plpgsql_exec_trigger(PLpgSQL_function *func,
TriggerData *trigdata);
extern void plpgsql_xact_cb(XactEvent event, void *arg);
extern void plpgsql_subxact_cb(SubXactEvent event, SubTransactionId mySubid,
- SubTransactionId parentSubid, void *arg);
+ SubTransactionId parentSubid, void *arg);
/* ----------
* Functions for the dynamic string handling in pl_funcs.c
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index 485550f9323..80ce24caef7 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -1,7 +1,7 @@
/**********************************************************************
* plpython.c - python as a procedural language for PostgreSQL
*
- * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.103 2007/08/10 03:16:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.104 2007/11/15 21:14:46 momjian Exp $
*
*********************************************************************
*/
@@ -28,6 +28,7 @@
*/
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
typedef int Py_ssize_t;
+
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#endif
@@ -1603,10 +1604,10 @@ static PyObject *
PLyBool_FromString(const char *src)
{
/*
- * We would like to use Py_RETURN_TRUE and Py_RETURN_FALSE here for
- * generating SQL from trigger functions, but those are only
- * supported in Python >= 2.3, and we support older
- * versions. http://docs.python.org/api/boolObjects.html
+ * We would like to use Py_RETURN_TRUE and Py_RETURN_FALSE here for
+ * generating SQL from trigger functions, but those are only supported in
+ * Python >= 2.3, and we support older versions.
+ * http://docs.python.org/api/boolObjects.html
*/
if (src[0] == 't')
return PyBool_FromLong(1);
@@ -1730,8 +1731,8 @@ PLyMapping_ToTuple(PLyTypeInfo * info, PyObject * mapping)
for (i = 0; i < desc->natts; ++i)
{
char *key;
- PyObject * volatile value,
- * volatile so;
+ PyObject *volatile value,
+ *volatile so;
key = NameStr(desc->attrs[i]->attname);
value = so = NULL;
@@ -1819,8 +1820,8 @@ PLySequence_ToTuple(PLyTypeInfo * info, PyObject * sequence)
nulls = palloc(sizeof(char) * desc->natts);
for (i = 0; i < desc->natts; ++i)
{
- PyObject * volatile value,
- * volatile so;
+ PyObject *volatile value,
+ *volatile so;
value = so = NULL;
PG_TRY();
@@ -1890,8 +1891,8 @@ PLyObject_ToTuple(PLyTypeInfo * info, PyObject * object)
for (i = 0; i < desc->natts; ++i)
{
char *key;
- PyObject * volatile value,
- * volatile so;
+ PyObject *volatile value,
+ *volatile so;
key = NameStr(desc->attrs[i]->attname);
value = so = NULL;
@@ -2020,13 +2021,13 @@ static PyMethodDef PLy_plan_methods[] = {
};
static PySequenceMethods PLy_result_as_sequence = {
- PLy_result_length, /* sq_length */
- NULL, /* sq_concat */
- NULL, /* sq_repeat */
- PLy_result_item, /* sq_item */
- PLy_result_slice, /* sq_slice */
- PLy_result_ass_item, /* sq_ass_item */
- PLy_result_ass_slice, /* sq_ass_slice */
+ PLy_result_length, /* sq_length */
+ NULL, /* sq_concat */
+ NULL, /* sq_repeat */
+ PLy_result_item, /* sq_item */
+ PLy_result_slice, /* sq_slice */
+ PLy_result_ass_item, /* sq_ass_item */
+ PLy_result_ass_slice, /* sq_ass_slice */
};
static PyTypeObject PLy_ResultType = {
@@ -2327,26 +2328,26 @@ PLy_spi_prepare(PyObject * self, PyObject * args)
{
char *sptr;
HeapTuple typeTup;
- Oid typeId;
- int32 typmod;
+ Oid typeId;
+ int32 typmod;
Form_pg_type typeStruct;
optr = PySequence_GetItem(list, i);
if (!PyString_Check(optr))
elog(ERROR, "Type names must be strings.");
sptr = PyString_AsString(optr);
-
+
/********************************************************
- * Resolve argument type names and then look them up by
- * oid in the system cache, and remember the required
+ * Resolve argument type names and then look them up by
+ * oid in the system cache, and remember the required
*information for input conversion.
- ********************************************************/
+ ********************************************************/
parseTypeString(sptr, &typeId, &typmod);
-
+
typeTup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(typeId),
- 0,0,0);
+ 0, 0, 0);
if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u", typeId);
@@ -2529,7 +2530,7 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, long limit)
}
PG_CATCH();
{
- int k;
+ int k;
MemoryContextSwitchTo(oldcontext);
PLy_error_in_progress = CopyErrorData();
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 675ec9597ad..4b72b860bbc 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -2,7 +2,7 @@
* pltcl.c - PostgreSQL support for Tcl as
* procedural language (PL)
*
- * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.116 2007/11/07 12:24:24 petere Exp $
+ * $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.117 2007/11/15 21:14:46 momjian Exp $
*
**********************************************************************/
@@ -184,7 +184,7 @@ static void pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
static ClientData
pltcl_InitNotifier(void)
{
- static int fakeThreadKey; /* To give valid address for ClientData */
+ static int fakeThreadKey; /* To give valid address for ClientData */
return (ClientData) &(fakeThreadKey);
}
@@ -225,8 +225,7 @@ pltcl_WaitForEvent(Tcl_Time *timePtr)
{
return 0;
}
-
-#endif /* HAVE_TCL_VERSION(8,2) */
+#endif /* HAVE_TCL_VERSION(8,2) */
/*
@@ -264,20 +263,21 @@ _PG_init(void)
#endif
#if HAVE_TCL_VERSION(8,4)
+
/*
* Override the functions in the Notifier subsystem. See comments above.
*/
{
Tcl_NotifierProcs notifier;
- notifier.setTimerProc = pltcl_SetTimer;
- notifier.waitForEventProc = pltcl_WaitForEvent;
+ notifier.setTimerProc = pltcl_SetTimer;
+ notifier.waitForEventProc = pltcl_WaitForEvent;
notifier.createFileHandlerProc = pltcl_CreateFileHandler;
notifier.deleteFileHandlerProc = pltcl_DeleteFileHandler;
- notifier.initNotifierProc = pltcl_InitNotifier;
- notifier.finalizeNotifierProc = pltcl_FinalizeNotifier;
- notifier.alertNotifierProc = pltcl_AlertNotifier;
- notifier.serviceModeHookProc = pltcl_ServiceModeHook;
+ notifier.initNotifierProc = pltcl_InitNotifier;
+ notifier.finalizeNotifierProc = pltcl_FinalizeNotifier;
+ notifier.alertNotifierProc = pltcl_AlertNotifier;
+ notifier.serviceModeHookProc = pltcl_ServiceModeHook;
Tcl_SetNotifier(&notifier);
}
#endif
@@ -1048,7 +1048,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid)
prodesc = (pltcl_proc_desc *) Tcl_GetHashValue(hashent);
uptodate = (prodesc->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) &&
- ItemPointerEquals(&prodesc->fn_tid, &procTup->t_self));
+ ItemPointerEquals(&prodesc->fn_tid, &procTup->t_self));
if (!uptodate)
{
@@ -1909,8 +1909,10 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
************************************************************/
for (i = 0; i < nargs; i++)
{
- Oid typId, typInput, typIOParam;
- int32 typmod;
+ Oid typId,
+ typInput,
+ typIOParam;
+ int32 typmod;
parseTypeString(args[i], &typId, &typmod);