inferred param types for PREPARE

Поиск
Список
Период
Сортировка
От Neil Conway
Тема inferred param types for PREPARE
Дата
Msg-id 1137312217.9145.41.camel@localhost.localdomain
обсуждение исходный текст
Ответы Re: inferred param types for PREPARE
Список pgsql-patches
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
prepared statements.

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:

state 1186

  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.

-Neil


Вложения

В списке pgsql-patches по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: TupleDesc refcounting
Следующее
От: Tom Lane
Дата:
Сообщение: Re: TupleDesc refcounting