diff options
author | Tom Lane | 2003-04-29 22:13:11 +0000 |
---|---|---|
committer | Tom Lane | 2003-04-29 22:13:11 +0000 |
commit | aa282d44464df0fbfa0672dc353d36734ec1092e (patch) | |
tree | dbf42be31346c6716bc33e73e801cda670fc60e4 /src/backend/parser/parser.c | |
parent | 19141f558411e96446294baf240eaeccf6d68b64 (diff) |
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/parser.c')
-rw-r--r-- | src/backend/parser/parser.c | 44 |
1 files changed, 5 insertions, 39 deletions
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c index 16745f7b370..37436d30079 100644 --- a/src/backend/parser/parser.c +++ b/src/backend/parser/parser.c @@ -14,7 +14,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.56 2003/04/27 20:09:44 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.57 2003/04/29 22:13:10 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -30,32 +30,27 @@ List *parsetree; /* result of parsing is left here */ -static Oid *param_type_info; /* state for param_type() */ -static int param_count; - static int lookahead_token; /* one-token lookahead */ static bool have_lookahead; /* lookahead_token set? */ /* - * parser - * Given a query in string form, and optionally info about - * parameter types, do lexical and syntactic analysis. + * raw_parser + * Given a query in string form, do lexical and grammatical analysis. * * Returns a list of raw (un-analyzed) parse trees. */ List * -parser(const char *str, Oid *typev, int nargs) +raw_parser(const char *str) { int yyresult; - parsetree = NIL; /* in case parser forgets to set it */ + parsetree = NIL; /* in case grammar forgets to set it */ have_lookahead = false; scanner_init(str); parser_init(); parse_expr_init(); - parser_param_set(typev, nargs); yyresult = yyparse(); @@ -70,35 +65,6 @@ parser(const char *str, Oid *typev, int nargs) /* - * Save information needed to fill out the type of Param references ($n) - * - * This is used for SQL functions, PREPARE statements, etc. It's split - * out from parser() setup because PREPARE needs to change the info after - * the grammar runs and before parse analysis is done on the preparable - * query. - */ -void -parser_param_set(Oid *typev, int nargs) -{ - param_type_info = typev; - param_count = nargs; -} - -/* - * param_type() - * - * Fetch a parameter type previously passed to parser_param_set - */ -Oid -param_type(int t) -{ - if (t > param_count || t <= 0) - return InvalidOid; - return param_type_info[t - 1]; -} - - -/* * Intermediate filter between parser and base lexer (base_yylex in scan.l). * * The filter is needed because in some cases SQL92 requires more than one |