aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_node.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-04-29 22:13:11 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-04-29 22:13:11 +0000
commitaa282d44464df0fbfa0672dc353d36734ec1092e (patch)
treedbf42be31346c6716bc33e73e801cda670fc60e4 /src/backend/parser/parse_node.c
parent19141f558411e96446294baf240eaeccf6d68b64 (diff)
downloadpostgresql-aa282d44464df0fbfa0672dc353d36734ec1092e.tar.gz
postgresql-aa282d44464df0fbfa0672dc353d36734ec1092e.zip
Infrastructure for deducing Param types from context, in the same way
that the types of untyped string-literal constants are deduced (ie, when coerce_type is applied to 'em, that's what the type must be). Remove the ancient hack of storing the input Param-types array as a global variable, and put the info into ParseState instead. This touches a lot of files because of adjustment of routine parameter lists, but it's really not a large patch. Note: PREPARE statement still insists on exact specification of parameter types, but that could easily be relaxed now, if we wanted to do so.
Diffstat (limited to 'src/backend/parser/parse_node.c')
-rw-r--r--src/backend/parser/parse_node.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c
index 700c4b158de..2f5775212cb 100644
--- a/src/backend/parser/parse_node.c
+++ b/src/backend/parser/parse_node.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.77 2003/04/08 23:20:02 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.78 2003/04/29 22:13:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,7 +39,12 @@ make_parsestate(ParseState *parentParseState)
pstate = palloc0(sizeof(ParseState));
pstate->parentParseState = parentParseState;
- pstate->p_last_resno = 1;
+
+ /* Fill in fields that don't start at null/false/zero */
+ pstate->p_next_resno = 1;
+
+ if (parentParseState)
+ pstate->p_variableparams = parentParseState->p_variableparams;
return pstate;
}
@@ -166,7 +171,8 @@ transformArraySubscripts(ParseState *pstate,
{
subexpr = transformExpr(pstate, ai->lidx);
/* If it's not int4 already, try to coerce */
- subexpr = coerce_to_target_type(subexpr, exprType(subexpr),
+ subexpr = coerce_to_target_type(pstate,
+ subexpr, exprType(subexpr),
INT4OID, -1,
COERCION_ASSIGNMENT,
COERCE_IMPLICIT_CAST);
@@ -186,7 +192,8 @@ transformArraySubscripts(ParseState *pstate,
}
subexpr = transformExpr(pstate, ai->uidx);
/* If it's not int4 already, try to coerce */
- subexpr = coerce_to_target_type(subexpr, exprType(subexpr),
+ subexpr = coerce_to_target_type(pstate,
+ subexpr, exprType(subexpr),
INT4OID, -1,
COERCION_ASSIGNMENT,
COERCE_IMPLICIT_CAST);
@@ -205,7 +212,8 @@ transformArraySubscripts(ParseState *pstate,
if (typesource != InvalidOid)
{
- assignFrom = coerce_to_target_type(assignFrom, typesource,
+ assignFrom = coerce_to_target_type(pstate,
+ assignFrom, typesource,
typeneeded, arrayTypMod,
COERCION_ASSIGNMENT,
COERCE_IMPLICIT_CAST);