Attached is a patch that makes the specification of parameters to the
PREPARE SQL statement more flexible: the user can specify "unknown" to
have the type of a particular parameter inferred from the context in
which the parameter is used (if possible). If fewer parameter types are
specified than the number of parameters used in the query, the remaining
parameter types will be inferred in the same way. This is analogous to
the way that parameters can be specified and inferred for protocol-level
The only trickiness was allowing "UNKNOWN" to be specified in the list
of type names in the PREPARE statement. Since UNKNOWN was previously an
unreserved_keyword, this caused reduce/reduce conflicts:
788 prep_type_elem: UNKNOWN .
1477 unreserved_keyword: UNKNOWN .
')' reduce using rule 788 (prep_type_elem)
')' [reduce using rule 1477 (unreserved_keyword)]
',' reduce using rule 788 (prep_type_elem)
',' [reduce using rule 1477 (unreserved_keyword)]
$default reduce using rule 1477 (unreserved_keyword)
I promoted UNKNOWN to be a col_name_keyword (like most of the other
builtin type names), which solved the problem. If there is a better fix,
let me know (I won't claim to be a yacc expert).
This is just a quick and dirty patch; if no one objects to this feature,
tomorrow I will post a revised patch that includes updates to the
documentation and regression tests.
pgsql-patches by date
|Next:||From: Tom Lane||Date: 2006-01-15 17:08:16|
|Subject: Re: TupleDesc refcounting |
|Previous:||From: Neil Conway||Date: 2006-01-15 05:41:24|
|Subject: Re: TupleDesc refcounting|