1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

pgindent run.

This commit is contained in:
Bruce Momjian
2003-08-04 00:43:34 +00:00
parent 63354a0228
commit 089003fb46
554 changed files with 24888 additions and 21245 deletions

View File

@@ -33,7 +33,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.38 2003/07/31 18:36:28 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.39 2003/08/04 00:43:33 momjian Exp $
*
**********************************************************************/
@@ -284,7 +284,7 @@ plperl_call_handler(PG_FUNCTION_ARGS)
* create the anonymous subroutine whose text is in the SV.
* Returns the SV containing the RV to the closure.
**********************************************************************/
static SV *
static SV *
plperl_create_sub(char *s, bool trusted)
{
dSP;
@@ -296,10 +296,11 @@ plperl_create_sub(char *s, bool trusted)
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(s, 0)));
PUTBACK;
/*
* G_KEEPERR seems to be needed here, else we don't recognize compile
* errors properly. Perhaps it's because there's another level of eval
* inside mksafefunc?
* errors properly. Perhaps it's because there's another level of
* eval inside mksafefunc?
*/
count = perl_call_pv((trusted ? "mksafefunc" : "mkunsafefunc"),
G_SCALAR | G_EVAL | G_KEEPERR);
@@ -373,7 +374,7 @@ plperl_init_shared_libs(pTHX)
* plperl_call_perl_func() - calls a perl function through the RV
* stored in the prodesc structure. massages the input parms properly
**********************************************************************/
static SV *
static SV *
plperl_call_perl_func(plperl_proc_desc * desc, FunctionCallInfo fcinfo)
{
dSP;
@@ -637,8 +638,8 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
free(prodesc);
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("plperl functions cannot return type %s",
format_type_be(procStruct->prorettype))));
errmsg("plperl functions cannot return type %s",
format_type_be(procStruct->prorettype))));
}
}
@@ -648,7 +649,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
free(prodesc);
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("plperl functions cannot return tuples yet")));
errmsg("plperl functions cannot return tuples yet")));
}
perm_fmgr_info(typeStruct->typinput, &(prodesc->result_in_func));
@@ -685,8 +686,8 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
free(prodesc);
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("plperl functions cannot take type %s",
format_type_be(procStruct->proargtypes[i]))));
errmsg("plperl functions cannot take type %s",
format_type_be(procStruct->proargtypes[i]))));
}
if (typeStruct->typrelid != InvalidOid)
@@ -739,7 +740,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
* plperl_build_tuple_argument() - Build a string for a ref to a hash
* from all attributes of a given tuple
**********************************************************************/
static SV *
static SV *
plperl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc)
{
int i;

View File

@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.64 2003/07/31 18:36:35 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.65 2003/08/04 00:43:33 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -88,10 +88,10 @@ static HTAB *plpgsql_HashTable = (HTAB *) NULL;
typedef struct plpgsql_hashent
{
PLpgSQL_func_hashkey key;
PLpgSQL_function *function;
} plpgsql_HashEnt;
PLpgSQL_function *function;
} plpgsql_HashEnt;
#define FUNCS_PER_USER 128 /* initial table size */
#define FUNCS_PER_USER 128 /* initial table size */
/* ----------
@@ -99,17 +99,17 @@ typedef struct plpgsql_hashent
* ----------
*/
static PLpgSQL_function *do_compile(FunctionCallInfo fcinfo,
HeapTuple procTup,
PLpgSQL_func_hashkey *hashkey);
HeapTuple procTup,
PLpgSQL_func_hashkey * hashkey);
static void plpgsql_compile_error_callback(void *arg);
static PLpgSQL_type *build_datatype(HeapTuple typeTup, int32 typmod);
static void compute_function_hashkey(FmgrInfo *flinfo,
Form_pg_proc procStruct,
PLpgSQL_func_hashkey *hashkey);
static PLpgSQL_function *plpgsql_HashTableLookup(PLpgSQL_func_hashkey *func_key);
static void plpgsql_HashTableInsert(PLpgSQL_function *function,
PLpgSQL_func_hashkey *func_key);
static void plpgsql_HashTableDelete(PLpgSQL_function *function);
Form_pg_proc procStruct,
PLpgSQL_func_hashkey * hashkey);
static PLpgSQL_function *plpgsql_HashTableLookup(PLpgSQL_func_hashkey * func_key);
static void plpgsql_HashTableInsert(PLpgSQL_function * function,
PLpgSQL_func_hashkey * func_key);
static void plpgsql_HashTableDelete(PLpgSQL_function * function);
/*
* This routine is a crock, and so is everyplace that calls it. The problem
@@ -157,14 +157,14 @@ plpgsql_compile(FunctionCallInfo fcinfo)
procStruct = (Form_pg_proc) GETSTRUCT(procTup);
/*
* See if there's already a cache entry for the current FmgrInfo.
* If not, try to find one in the hash table.
* See if there's already a cache entry for the current FmgrInfo. If
* not, try to find one in the hash table.
*/
function = (PLpgSQL_function *) fcinfo->flinfo->fn_extra;
if (!function)
{
/* First time through in this backend? If so, init hashtable */
/* First time through in this backend? If so, init hashtable */
if (!plpgsql_HashTable)
plpgsql_HashTableInit();
@@ -180,10 +180,10 @@ plpgsql_compile(FunctionCallInfo fcinfo)
{
/* We have a compiled function, but is it still valid? */
if (!(function->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) &&
function->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data)))
function->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data)))
{
/*
* Nope, drop the hashtable entry. XXX someday, free all the
* Nope, drop the hashtable entry. XXX someday, free all the
* subsidiary storage as well.
*/
plpgsql_HashTableDelete(function);
@@ -193,7 +193,8 @@ plpgsql_compile(FunctionCallInfo fcinfo)
}
/*
* If the function wasn't found or was out-of-date, we have to compile it
* If the function wasn't found or was out-of-date, we have to compile
* it
*/
if (!function)
{
@@ -229,7 +230,7 @@ plpgsql_compile(FunctionCallInfo fcinfo)
static PLpgSQL_function *
do_compile(FunctionCallInfo fcinfo,
HeapTuple procTup,
PLpgSQL_func_hashkey *hashkey)
PLpgSQL_func_hashkey * hashkey)
{
Form_pg_proc procStruct = (Form_pg_proc) GETSTRUCT(procTup);
int functype = CALLED_AS_TRIGGER(fcinfo) ? T_TRIGGER : T_FUNCTION;
@@ -247,12 +248,12 @@ do_compile(FunctionCallInfo fcinfo,
Oid rettypeid;
/*
* Setup the scanner input and error info. We assume that this
* 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.
*/
proc_source = DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(&procStruct->prosrc)));
PointerGetDatum(&procStruct->prosrc)));
plpgsql_scanner_init(proc_source, functype);
pfree(proc_source);
@@ -297,13 +298,13 @@ do_compile(FunctionCallInfo fcinfo,
case T_FUNCTION:
/*
* Check for a polymorphic returntype. If found, use the actual
* returntype type from the caller's FuncExpr node, if we
* have one.
* Check for a polymorphic returntype. If found, use the
* actual returntype type from the caller's FuncExpr node, if
* we have one.
*
* Note: errcode is FEATURE_NOT_SUPPORTED because it should always
* work; if it doesn't we're in some context that fails to make
* the info available.
* Note: errcode is FEATURE_NOT_SUPPORTED because it should
* always work; if it doesn't we're in some context that fails
* to make the info available.
*/
rettypeid = procStruct->prorettype;
if (rettypeid == ANYARRAYOID || rettypeid == ANYELEMENTOID)
@@ -312,9 +313,9 @@ do_compile(FunctionCallInfo fcinfo,
if (!OidIsValid(rettypeid))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("could not determine actual return type "
"for polymorphic function \"%s\"",
plpgsql_error_funcname)));
errmsg("could not determine actual return type "
"for polymorphic function \"%s\"",
plpgsql_error_funcname)));
}
/*
@@ -339,7 +340,7 @@ do_compile(FunctionCallInfo fcinfo,
{
if (rettypeid == VOIDOID ||
rettypeid == RECORDOID)
/* okay */ ;
/* okay */ ;
else if (rettypeid == TRIGGEROID)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -347,8 +348,8 @@ do_compile(FunctionCallInfo fcinfo,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("plpgsql functions cannot return type %s",
format_type_be(rettypeid))));
errmsg("plpgsql functions cannot return type %s",
format_type_be(rettypeid))));
}
if (typeStruct->typrelid != InvalidOid ||
@@ -362,8 +363,8 @@ do_compile(FunctionCallInfo fcinfo,
perm_fmgr_info(typeStruct->typinput, &(function->fn_retinput));
/*
* install $0 reference, but only for polymorphic
* return types
* install $0 reference, but only for polymorphic return
* types
*/
if (procStruct->prorettype == ANYARRAYOID ||
procStruct->prorettype == ANYELEMENTOID)
@@ -432,8 +433,8 @@ do_compile(FunctionCallInfo fcinfo,
if (typeStruct->typtype == 'p')
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("plpgsql functions cannot take type %s",
format_type_be(argtypeid))));
errmsg("plpgsql functions cannot take type %s",
format_type_be(argtypeid))));
if (typeStruct->typrelid != InvalidOid)
{
@@ -1283,7 +1284,10 @@ plpgsql_parse_tripwordtype(char *word)
memset(cp[0], 0, (i + 1) * sizeof(char));
memcpy(cp[0], word, i * sizeof(char));
/* qualified_att_len - one based position + 1 (null terminator) */
/*
* qualified_att_len - one based position + 1 (null
* terminator)
*/
cp[1] = (char *) palloc((qualified_att_len - i) * sizeof(char));
memset(cp[1], 0, (qualified_att_len - i) * sizeof(char));
memcpy(cp[1], &word[i + 1], (qualified_att_len - i - 1) * sizeof(char));
@@ -1691,7 +1695,7 @@ plpgsql_yyerror(const char *s)
plpgsql_error_lineno = plpgsql_scanner_lineno();
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
/* translator: first %s is a phrase like "syntax error" */
/* translator: first %s is a phrase like "syntax error" */
errmsg("%s at or near \"%s\"", s, plpgsql_yytext)));
}
@@ -1704,9 +1708,9 @@ plpgsql_yyerror(const char *s)
static void
compute_function_hashkey(FmgrInfo *flinfo,
Form_pg_proc procStruct,
PLpgSQL_func_hashkey *hashkey)
PLpgSQL_func_hashkey * hashkey)
{
int i;
int i;
/* Make sure any unused bytes of the struct are zero */
MemSet(hashkey, 0, sizeof(PLpgSQL_func_hashkey));
@@ -1720,8 +1724,7 @@ compute_function_hashkey(FmgrInfo *flinfo,
/*
* Check for polymorphic arguments. If found, use the actual
* parameter type from the caller's FuncExpr node, if we
* have one.
* parameter type from the caller's FuncExpr node, if we have one.
*
* We can support arguments of type ANY the same way as normal
* polymorphic arguments.
@@ -1759,14 +1762,14 @@ plpgsql_HashTableInit(void)
}
static PLpgSQL_function *
plpgsql_HashTableLookup(PLpgSQL_func_hashkey *func_key)
plpgsql_HashTableLookup(PLpgSQL_func_hashkey * func_key)
{
plpgsql_HashEnt *hentry;
plpgsql_HashEnt *hentry;
hentry = (plpgsql_HashEnt*) hash_search(plpgsql_HashTable,
(void *) func_key,
HASH_FIND,
NULL);
hentry = (plpgsql_HashEnt *) hash_search(plpgsql_HashTable,
(void *) func_key,
HASH_FIND,
NULL);
if (hentry)
return hentry->function;
else
@@ -1774,16 +1777,16 @@ plpgsql_HashTableLookup(PLpgSQL_func_hashkey *func_key)
}
static void
plpgsql_HashTableInsert(PLpgSQL_function *function,
PLpgSQL_func_hashkey *func_key)
plpgsql_HashTableInsert(PLpgSQL_function * function,
PLpgSQL_func_hashkey * func_key)
{
plpgsql_HashEnt *hentry;
bool found;
plpgsql_HashEnt *hentry;
bool found;
hentry = (plpgsql_HashEnt*) hash_search(plpgsql_HashTable,
(void *) func_key,
HASH_ENTER,
&found);
hentry = (plpgsql_HashEnt *) hash_search(plpgsql_HashTable,
(void *) func_key,
HASH_ENTER,
&found);
if (hentry == NULL)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
@@ -1797,14 +1800,14 @@ plpgsql_HashTableInsert(PLpgSQL_function *function,
}
static void
plpgsql_HashTableDelete(PLpgSQL_function *function)
plpgsql_HashTableDelete(PLpgSQL_function * function)
{
plpgsql_HashEnt *hentry;
plpgsql_HashEnt *hentry;
hentry = (plpgsql_HashEnt*) hash_search(plpgsql_HashTable,
(void *) function->fn_hashkey,
HASH_REMOVE,
NULL);
hentry = (plpgsql_HashEnt *) hash_search(plpgsql_HashTable,
(void *) function->fn_hashkey,
HASH_REMOVE,
NULL);
if (hentry == NULL)
elog(WARNING, "trying to delete function that does not exist");
}

View File

@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.89 2003/07/27 18:38:26 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.90 2003/08/04 00:43:33 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -55,7 +55,7 @@
#include "utils/syscache.h"
static const char * const raise_skip_msg = "RAISE";
static const char *const raise_skip_msg = "RAISE";
/************************************************************
* Local function forward declarations
@@ -73,7 +73,7 @@ static int exec_stmt(PLpgSQL_execstate * estate,
static int exec_stmt_assign(PLpgSQL_execstate * estate,
PLpgSQL_stmt_assign * stmt);
static int exec_stmt_perform(PLpgSQL_execstate * estate,
PLpgSQL_stmt_perform * stmt);
PLpgSQL_stmt_perform * stmt);
static int exec_stmt_getdiag(PLpgSQL_execstate * estate,
PLpgSQL_stmt_getdiag * stmt);
static int exec_stmt_if(PLpgSQL_execstate * estate,
@@ -129,15 +129,15 @@ static void exec_assign_expr(PLpgSQL_execstate * estate,
static void exec_assign_value(PLpgSQL_execstate * estate,
PLpgSQL_datum * target,
Datum value, Oid valtype, bool *isNull);
static void exec_eval_datum(PLpgSQL_execstate *estate,
PLpgSQL_datum *datum,
Oid expectedtypeid,
Oid *typeid,
Datum *value,
bool *isnull);
static void exec_eval_datum(PLpgSQL_execstate * estate,
PLpgSQL_datum * datum,
Oid expectedtypeid,
Oid *typeid,
Datum *value,
bool *isnull);
static int exec_eval_subscript(PLpgSQL_execstate * estate,
PLpgSQL_expr * expr,
bool *isNull);
PLpgSQL_expr * expr,
bool *isNull);
static Datum exec_eval_expr(PLpgSQL_execstate * estate,
PLpgSQL_expr * expr,
bool *isNull,
@@ -155,8 +155,8 @@ static Datum exec_cast_value(Datum value, Oid valtype,
int32 reqtypmod,
bool *isnull);
static Datum exec_simple_cast_value(Datum value, Oid valtype,
Oid reqtype, int32 reqtypmod,
bool *isnull);
Oid reqtype, int32 reqtypmod,
bool *isnull);
static void exec_init_tuple_store(PLpgSQL_execstate * estate);
static bool compatible_tupdesc(TupleDesc td1, TupleDesc td2);
static void exec_set_found(PLpgSQL_execstate * estate, bool state);
@@ -300,8 +300,8 @@ plpgsql_exec_function(PLpgSQL_function * func, FunctionCallInfo fcinfo)
estate.err_stmt = NULL;
estate.err_text = NULL;
ereport(ERROR,
(errcode(ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT),
errmsg("control reached end of function without RETURN")));
(errcode(ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT),
errmsg("control reached end of function without RETURN")));
}
/*
@@ -406,7 +406,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
int i;
PLpgSQL_var *var;
PLpgSQL_rec *rec_new,
*rec_old;
*rec_old;
HeapTuple rettup;
/*
@@ -617,8 +617,8 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
estate.err_stmt = NULL;
estate.err_text = NULL;
ereport(ERROR,
(errcode(ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT),
errmsg("control reached end of trigger procedure without RETURN")));
(errcode(ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT),
errmsg("control reached end of trigger procedure without RETURN")));
}
if (estate.retisset)
@@ -692,11 +692,15 @@ plpgsql_exec_error_callback(void *arg)
{
/*
* We don't expend the cycles to run gettext() on err_text unless
* we actually need it. Therefore, places that set up err_text should
* use gettext_noop() to ensure the strings get recorded in the
* message dictionary.
* we actually need it. Therefore, places that set up err_text
* should use gettext_noop() to ensure the strings get recorded in
* the message dictionary.
*/
/*
* translator: last %s is a phrase such as "while storing call
* arguments into local variables"
*/
/* translator: last %s is a phrase such as "while storing call arguments into local variables" */
errcontext("PL/pgSQL function \"%s\" %s",
estate->err_func->fn_name,
gettext(estate->err_text));
@@ -776,9 +780,9 @@ exec_stmt_block(PLpgSQL_execstate * estate, PLpgSQL_stmt_block * block)
var->isnull = true;
if (var->notnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("variable \"%s\" declared NOT NULL cannot default to NULL",
var->refname)));
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("variable \"%s\" declared NOT NULL cannot default to NULL",
var->refname)));
}
else
{
@@ -1018,7 +1022,7 @@ exec_stmt_perform(PLpgSQL_execstate * estate, PLpgSQL_stmt_perform * stmt)
if (rc != SPI_OK_SELECT)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("query \"%s\" did not return data", expr->query)));
errmsg("query \"%s\" did not return data", expr->query)));
exec_set_found(estate, (estate->eval_processed != 0));
@@ -1619,7 +1623,7 @@ exec_stmt_return_next(PLpgSQL_execstate * estate,
if (!estate->retisset)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use RETURN NEXT in a non-SETOF function")));
errmsg("cannot use RETURN NEXT in a non-SETOF function")));
if (estate->tuple_store == NULL)
exec_init_tuple_store(estate);
@@ -1641,7 +1645,7 @@ exec_stmt_return_next(PLpgSQL_execstate * estate,
if (!compatible_tupdesc(tupdesc, rec->tupdesc))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("wrong record type supplied in RETURN NEXT")));
errmsg("wrong record type supplied in RETURN NEXT")));
tuple = rec->tup;
}
else if (stmt->row)
@@ -1653,7 +1657,7 @@ exec_stmt_return_next(PLpgSQL_execstate * estate,
if (natts != stmt->row->nfields)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("wrong record type supplied in RETURN NEXT")));
errmsg("wrong record type supplied in RETURN NEXT")));
dvalues = (Datum *) palloc0(natts * sizeof(Datum));
nulls = (char *) palloc(natts * sizeof(char));
@@ -1667,7 +1671,7 @@ exec_stmt_return_next(PLpgSQL_execstate * estate,
if (var->datatype->typoid != tupdesc->attrs[i]->atttypid)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("wrong record type supplied in RETURN NEXT")));
errmsg("wrong record type supplied in RETURN NEXT")));
dvalues[i] = var->value;
if (!var->isnull)
nulls[i] = ' ';
@@ -1689,7 +1693,7 @@ exec_stmt_return_next(PLpgSQL_execstate * estate,
if (natts != 1)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("wrong result type supplied in RETURN NEXT")));
errmsg("wrong result type supplied in RETURN NEXT")));
retval = exec_eval_expr(estate,
stmt->expr,
@@ -1804,9 +1808,7 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
InvalidOid,
&paramtypeid, &paramvalue, &paramisnull);
if (paramisnull)
{
extval = "<NULL>";
}
else
{
typetup = SearchSysCache(TYPEOID,
@@ -1820,8 +1822,8 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
fmgr_info(typeStruct->typoutput, &finfo_output);
extval = DatumGetCString(FunctionCall3(&finfo_output,
paramvalue,
ObjectIdGetDatum(typeStruct->typelem),
Int32GetDatum(-1)));
ObjectIdGetDatum(typeStruct->typelem),
Int32GetDatum(-1)));
ReleaseSysCache(typetup);
}
plpgsql_dstring_append(&ds, extval);
@@ -1831,9 +1833,9 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
/*
* Occurrences of single ' are removed. double ' are reduced to
* single ones. We must do this because the parameter stored
* by the grammar is the raw T_STRING input literal, rather than
* the de-lexed string as you might expect ...
* single ones. We must do this because the parameter stored by
* the grammar is the raw T_STRING input literal, rather than the
* de-lexed string as you might expect ...
*/
if (*cp == '\'')
{
@@ -1850,7 +1852,7 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
/*
* Throw the error (may or may not come back)
*/
estate->err_text = raise_skip_msg; /* suppress traceback of raise */
estate->err_text = raise_skip_msg; /* suppress traceback of raise */
ereport(stmt->elog_level,
(errmsg_internal("%s", plpgsql_dstring_get(&ds))));
@@ -1950,8 +1952,8 @@ exec_prepare_plan(PLpgSQL_execstate * estate,
for (i = 0; i < expr->nparams; i++)
{
Datum paramval;
bool paramisnull;
Datum paramval;
bool paramisnull;
exec_eval_datum(estate, estate->datums[expr->params[i]],
InvalidOid,
@@ -2041,7 +2043,7 @@ exec_stmt_execsql(PLpgSQL_execstate * estate,
case SPI_OK_SELECT:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("SELECT query has no destination for result data"),
errmsg("SELECT query has no destination for result data"),
errhint("If you want to discard the results, use PERFORM instead.")));
default:
@@ -2501,7 +2503,7 @@ exec_stmt_open(PLpgSQL_execstate * estate, PLpgSQL_stmt_open * stmt)
if (curvar->cursor_explicit_argrow < 0)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("arguments given for cursor without arguments")));
errmsg("arguments given for cursor without arguments")));
memset(&set_args, 0, sizeof(set_args));
set_args.cmd_type = PLPGSQL_STMT_SELECT;
@@ -2600,7 +2602,7 @@ exec_stmt_fetch(PLpgSQL_execstate * estate, PLpgSQL_stmt_fetch * stmt)
if (curvar->isnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("cursor variable \"%s\" is NULL", curvar->refname)));
errmsg("cursor variable \"%s\" is NULL", curvar->refname)));
curname = DatumGetCString(DirectFunctionCall1(textout, curvar->value));
portal = SPI_cursor_find(curname);
@@ -2669,7 +2671,7 @@ exec_stmt_close(PLpgSQL_execstate * estate, PLpgSQL_stmt_close * stmt)
if (curvar->isnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("cursor variable \"%s\" is NULL", curvar->refname)));
errmsg("cursor variable \"%s\" is NULL", curvar->refname)));
curname = DatumGetCString(DirectFunctionCall1(textout, curvar->value));
portal = SPI_cursor_find(curname);
@@ -2810,10 +2812,10 @@ exec_assign_value(PLpgSQL_execstate * estate,
*/
if (!HeapTupleIsValid(rec->tup))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("record \"%s\" is not assigned yet",
rec->refname),
errdetail("The tuple structure of a not-yet-assigned record is indeterminate.")));
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("record \"%s\" is not assigned yet",
rec->refname),
errdetail("The tuple structure of a not-yet-assigned record is indeterminate.")));
/*
* Get the number of the records field to change and the
@@ -2898,15 +2900,16 @@ exec_assign_value(PLpgSQL_execstate * estate,
/*
* Target is an element of an array
*
* To handle constructs like x[1][2] := something, we have to
* be prepared to deal with a chain of arrayelem datums.
* Chase back to find the base array datum, and save the
* subscript expressions as we go. (We are scanning right to
* left here, but want to evaluate the subscripts left-to-right
* to minimize surprises.)
* To handle constructs like x[1][2] := something, we have to be
* prepared to deal with a chain of arrayelem datums. Chase
* back to find the base array datum, and save the subscript
* expressions as we go. (We are scanning right to left here,
* but want to evaluate the subscripts left-to-right to
* minimize surprises.)
*/
nsubscripts = 0;
do {
do
{
PLpgSQL_arrayelem *arrayelem = (PLpgSQL_arrayelem *) target;
if (nsubscripts >= MAXDIM)
@@ -2932,20 +2935,20 @@ exec_assign_value(PLpgSQL_execstate * estate,
havenullsubscript = false;
for (i = 0; i < nsubscripts; i++)
{
bool subisnull;
bool subisnull;
subscriptvals[i] =
exec_eval_subscript(estate,
subscripts[nsubscripts-1-i],
subscripts[nsubscripts - 1 - i],
&subisnull);
havenullsubscript |= subisnull;
}
/*
* Skip the assignment if we have any nulls, either in the
* original array value, the subscripts, or the righthand side.
* This is pretty bogus but it corresponds to the current
* behavior of ExecEvalArrayRef().
* original array value, the subscripts, or the righthand
* side. This is pretty bogus but it corresponds to the
* current behavior of ExecEvalArrayRef().
*/
if (oldarrayisnull || havenullsubscript || *isNull)
return;
@@ -3014,8 +3017,8 @@ exec_assign_value(PLpgSQL_execstate * estate,
* at the stored value in the case of pass-by-reference datatypes.
*/
static void
exec_eval_datum(PLpgSQL_execstate *estate,
PLpgSQL_datum *datum,
exec_eval_datum(PLpgSQL_execstate * estate,
PLpgSQL_datum * datum,
Oid expectedtypeid,
Oid *typeid,
Datum *value,
@@ -3047,10 +3050,10 @@ exec_eval_datum(PLpgSQL_execstate *estate,
rec = (PLpgSQL_rec *) (estate->datums[recfield->recparentno]);
if (!HeapTupleIsValid(rec->tup))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("record \"%s\" is not assigned yet",
rec->refname),
errdetail("The tuple structure of a not-yet-assigned record is indeterminate.")));
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("record \"%s\" is not assigned yet",
rec->refname),
errdetail("The tuple structure of a not-yet-assigned record is indeterminate.")));
fno = SPI_fnumber(rec->tupdesc, recfield->fieldname);
if (fno == SPI_ERROR_NOATTRIBUTE)
ereport(ERROR,
@@ -3154,7 +3157,7 @@ exec_eval_expr(PLpgSQL_execstate * estate,
if (rc != SPI_OK_SELECT)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("query \"%s\" did not return data", expr->query)));
errmsg("query \"%s\" did not return data", expr->query)));
/*
* If there are no rows selected, the result is NULL.
@@ -3375,7 +3378,7 @@ exec_move_row(PLpgSQL_execstate * estate,
else if (tupdesc)
{
/* If we have a tupdesc but no data, form an all-nulls tuple */
char *nulls;
char *nulls;
/* +1 to avoid possible palloc(0) if no attributes */
nulls = (char *) palloc(tupdesc->natts * sizeof(char) + 1);
@@ -3387,9 +3390,7 @@ exec_move_row(PLpgSQL_execstate * estate,
pfree(nulls);
}
else
{
rec->tup = NULL;
}
if (tupdesc)
{
@@ -3397,9 +3398,7 @@ exec_move_row(PLpgSQL_execstate * estate,
rec->freetupdesc = true;
}
else
{
rec->tupdesc = NULL;
}
return;
}
@@ -3415,8 +3414,8 @@ exec_move_row(PLpgSQL_execstate * estate,
* ALTER TABLE. Ignore extra columns and assume NULL for missing
* columns, the same as heap_getattr would do.
*
* If we have no tuple data at all, we'll assign NULL to all columns
* of the row variable.
* If we have no tuple data at all, we'll assign NULL to all columns of
* the row variable.
*/
if (row != NULL)
{
@@ -3673,7 +3672,7 @@ exec_simple_check_node(Node *node)
case T_ArrayExpr:
{
ArrayExpr *expr = (ArrayExpr *) node;
ArrayExpr *expr = (ArrayExpr *) node;
if (!exec_simple_check_node((Node *) expr->elements))
return FALSE;
@@ -3683,7 +3682,7 @@ exec_simple_check_node(Node *node)
case T_CoalesceExpr:
{
CoalesceExpr *expr = (CoalesceExpr *) node;
CoalesceExpr *expr = (CoalesceExpr *) node;
if (!exec_simple_check_node((Node *) expr->args))
return FALSE;
@@ -3791,9 +3790,9 @@ exec_simple_check_plan(PLpgSQL_expr * expr)
return;
/*
* Yes - this is a simple expression. Prepare to execute it.
* We need an EState and an expression state tree, which we'll put
* into the plan context so they will have appropriate lifespan.
* Yes - this is a simple expression. Prepare to execute it. We need
* an EState and an expression state tree, which we'll put into the
* plan context so they will have appropriate lifespan.
*/
oldcontext = MemoryContextSwitchTo(spi_plan->plancxt);

View File

@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.28 2003/07/28 00:09:16 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.29 2003/08/04 00:43:33 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -410,8 +410,8 @@ plpgsql_convert_ident(const char *s, char **output, int numidents)
else
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("qualified identifier cannot be used here: %s",
sstart)));
errmsg("qualified identifier cannot be used here: %s",
sstart)));
/* If not done, skip whitespace, dot, whitespace */
if (*s)
@@ -1046,7 +1046,7 @@ plpgsql_dumptree(PLpgSQL_function * func)
((PLpgSQL_recfield *) d)->recparentno);
break;
case PLPGSQL_DTYPE_ARRAYELEM:
printf("ARRAYELEM of VAR %d subscript ",
printf("ARRAYELEM of VAR %d subscript ",
((PLpgSQL_arrayelem *) d)->arrayparentno);
dump_expr(((PLpgSQL_arrayelem *) d)->subscript);
printf("\n");

View File

@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.16 2003/07/31 18:36:35 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.17 2003/08/04 00:43:33 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -46,7 +46,7 @@
static int plpgsql_firstcall = 1;
void plpgsql_init(void);
void plpgsql_init(void);
static void plpgsql_init_all(void);
@@ -78,8 +78,8 @@ plpgsql_init_all(void)
plpgsql_init();
/*
* Any other initialization that must be done each time a new
* backend starts -- currently none
* Any other initialization that must be done each time a new backend
* starts -- currently none
*/
}

View File

@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.38 2003/07/31 18:36:35 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.39 2003/08/04 00:43:33 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -311,7 +311,7 @@ typedef struct
int cmd_type;
int lineno;
PLpgSQL_expr *expr;
} PLpgSQL_stmt_perform;
} PLpgSQL_stmt_perform;
typedef struct
{ /* Get Diagnostics item */
@@ -489,14 +489,15 @@ typedef struct
typedef struct PLpgSQL_func_hashkey
{ /* Hash lookup key for functions */
Oid funcOid;
Oid funcOid;
/*
* We include actual argument types in the hash key to support
* polymorphic PLpgSQL functions. Be careful that extra positions
* are zeroed!
* polymorphic PLpgSQL functions. Be careful that extra positions are
* zeroed!
*/
Oid argtypes[FUNC_MAX_ARGS];
} PLpgSQL_func_hashkey;
Oid argtypes[FUNC_MAX_ARGS];
} PLpgSQL_func_hashkey;
typedef struct PLpgSQL_function
@@ -506,7 +507,7 @@ typedef struct PLpgSQL_function
TransactionId fn_xmin;
CommandId fn_cmin;
int fn_functype;
PLpgSQL_func_hashkey *fn_hashkey; /* back-link to hashtable key */
PLpgSQL_func_hashkey *fn_hashkey; /* back-link to hashtable key */
Oid fn_rettype;
int fn_rettyplen;
@@ -566,9 +567,9 @@ typedef struct
ExprContext *eval_econtext;
/* status information for error context reporting */
PLpgSQL_function *err_func; /* current func */
PLpgSQL_stmt *err_stmt; /* current stmt */
const char *err_text; /* additional state info */
PLpgSQL_function *err_func; /* current func */
PLpgSQL_stmt *err_stmt; /* current stmt */
const char *err_text; /* additional state info */
} PLpgSQL_execstate;

View File

@@ -29,7 +29,7 @@
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.36 2003/07/31 18:36:39 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.37 2003/08/04 00:43:33 momjian Exp $
*
*********************************************************************
*/
@@ -352,9 +352,7 @@ plpython_call_handler(PG_FUNCTION_ARGS)
else
PLy_restart_in_progress += 1;
if (proc)
{
Py_DECREF(proc->me);
}
RERAISE_EXC();
}
@@ -573,7 +571,7 @@ PLy_modify_tuple(PLyProcedure * proc, PyObject * pltd, TriggerData *tdata,
modvalues[j] = FunctionCall3(&proc->result.out.r.atts[atti].typfunc,
CStringGetDatum(src),
ObjectIdGetDatum(proc->result.out.r.atts[atti].typelem),
Int32GetDatum(tupdesc->attrs[atti]->atttypmod));
Int32GetDatum(tupdesc->attrs[atti]->atttypmod));
modnulls[j] = ' ';
Py_DECREF(plstr);
@@ -587,8 +585,8 @@ PLy_modify_tuple(PLyProcedure * proc, PyObject * pltd, TriggerData *tdata,
modvalues, modnulls);
/*
* FIXME -- these leak if not explicitly pfree'd by other elog
* calls, no?
* FIXME -- these leak if not explicitly pfree'd by other elog calls,
* no?
*/
pfree(modattrs);
pfree(modvalues);
@@ -847,7 +845,7 @@ PLy_procedure_call(PLyProcedure * proc, char *kargs, PyObject * vargs)
current = PLy_last_procedure;
PLy_last_procedure = proc;
PyDict_SetItemString(proc->globals, kargs, vargs);
rv = PyEval_EvalCode( (PyCodeObject*)proc->code, proc->globals, proc->globals);
rv = PyEval_EvalCode((PyCodeObject *) proc->code, proc->globals, proc->globals);
PLy_last_procedure = current;
if ((rv == NULL) || (PyErr_Occurred()))
@@ -994,7 +992,7 @@ static PLyProcedure *
PLy_procedure_create(FunctionCallInfo fcinfo, bool is_trigger,
HeapTuple procTup, char *key)
{
char procName[NAMEDATALEN+256];
char procName[NAMEDATALEN + 256];
DECLARE_EXC();
Form_pg_proc procStruct;
@@ -1050,7 +1048,7 @@ PLy_procedure_create(FunctionCallInfo fcinfo, bool is_trigger,
Form_pg_type rvTypeStruct;
rvTypeTup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(procStruct->prorettype),
ObjectIdGetDatum(procStruct->prorettype),
0, 0, 0);
if (!HeapTupleIsValid(rvTypeTup))
elog(ERROR, "cache lookup failed for type %u",
@@ -1089,7 +1087,7 @@ PLy_procedure_create(FunctionCallInfo fcinfo, bool is_trigger,
Form_pg_type argTypeStruct;
argTypeTup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(procStruct->proargtypes[i]),
ObjectIdGetDatum(procStruct->proargtypes[i]),
0, 0, 0);
if (!HeapTupleIsValid(argTypeTup))
elog(ERROR, "cache lookup failed for type %u",
@@ -1158,7 +1156,7 @@ PLy_procedure_compile(PLyProcedure * proc, const char *src)
if ((crv != NULL) && (!PyErr_Occurred()))
{
int clen;
char call[NAMEDATALEN+256];
char call[NAMEDATALEN + 256];
Py_DECREF(crv);
@@ -1271,7 +1269,7 @@ PLy_input_tuple_funcs(PLyTypeInfo * arg, TupleDesc desc)
Form_pg_type typeStruct;
typeTup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(desc->attrs[i]->atttypid),
ObjectIdGetDatum(desc->attrs[i]->atttypid),
0, 0, 0);
if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u",
@@ -1306,7 +1304,7 @@ PLy_output_tuple_funcs(PLyTypeInfo * arg, TupleDesc desc)
Form_pg_type typeStruct;
typeTup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(desc->attrs[i]->atttypid),
ObjectIdGetDatum(desc->attrs[i]->atttypid),
0, 0, 0);
if (!HeapTupleIsValid(typeTup))
elog(ERROR, "cache lookup failed for type %u",
@@ -2045,7 +2043,7 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, int limit)
int i,
rv;
PLyPlanObject *plan;
char *nulls;
char *nulls;
enter();
@@ -2118,21 +2116,21 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, int limit)
elem = PySequence_GetItem(list, i);
if (elem != Py_None)
{
so = PyObject_Str(elem);
sv = PyString_AsString(so);
so = PyObject_Str(elem);
sv = PyString_AsString(so);
/*
* FIXME -- if this can elog, we have leak
*/
plan->values[i] = FunctionCall3(&(plan->args[i].out.d.typfunc),
CStringGetDatum(sv),
ObjectIdGetDatum(plan->args[i].out.d.typelem),
Int32GetDatum(-1));
Py_DECREF(so);
Py_DECREF(elem);
/*
* FIXME -- if this can elog, we have leak
*/
plan->values[i] = FunctionCall3(&(plan->args[i].out.d.typfunc),
CStringGetDatum(sv),
ObjectIdGetDatum(plan->args[i].out.d.typelem),
Int32GetDatum(-1));
nulls[i] = ' ';
Py_DECREF(so);
Py_DECREF(elem);
nulls[i] = ' ';
}
else
{
@@ -2144,9 +2142,7 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, int limit)
nulls[i] = '\0';
}
else
{
nulls = NULL;
}
rv = SPI_execp(plan->plan, plan->values, nulls, limit);
RESTORE_EXC();
@@ -2347,8 +2343,8 @@ PLy_init_all(void)
plpython_init();
/*
* Any other initialization that must be done each time a new
* backend starts -- currently none
* Any other initialization that must be done each time a new backend
* starts -- currently none
*/
}

View File

@@ -31,7 +31,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.73 2003/07/31 18:36:46 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.74 2003/08/04 00:43:33 momjian Exp $
*
**********************************************************************/
@@ -128,8 +128,8 @@ typedef struct pltcl_query_desc
/**********************************************************************
* Global data
**********************************************************************/
static bool pltcl_pm_init_done = false;
static bool pltcl_be_init_done = false;
static bool pltcl_pm_init_done = false;
static bool pltcl_be_init_done = false;
static int pltcl_call_level = 0;
static int pltcl_restart_in_progress = 0;
static Tcl_Interp *pltcl_hold_interp = NULL;
@@ -1095,8 +1095,8 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger)
free(prodesc);
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("pltcl functions cannot return type %s",
format_type_be(procStruct->prorettype))));
errmsg("pltcl functions cannot return type %s",
format_type_be(procStruct->prorettype))));
}
}
@@ -1106,7 +1106,7 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger)
free(prodesc);
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("pltcl functions cannot return tuples yet")));
errmsg("pltcl functions cannot return tuples yet")));
}
perm_fmgr_info(typeStruct->typinput, &(prodesc->result_in_func));
@@ -1145,7 +1145,7 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("pltcl functions cannot take type %s",
format_type_be(procStruct->proargtypes[i]))));
format_type_be(procStruct->proargtypes[i]))));
}
if (typeStruct->typrelid != InvalidOid)
@@ -2280,7 +2280,7 @@ pltcl_set_tuple_values(Tcl_Interp *interp, CONST84 char *arrayname,
CONST84 char **arrptr;
CONST84 char **nameptr;
CONST84 char *nullname = NULL;
CONST84 char *nullname = NULL;
/************************************************************
* Prepare pointers for Tcl_SetVar2() below and in array