Add hint for people who place EXECUTE USING arguments in parentheses (in plpgsql)

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Add hint for people who place EXECUTE USING arguments in parentheses (in plpgsql)
Дата
Msg-id CAKFQuwaggRt64JJuXvcXCUvWPN7ZUvX9S+ohnjgsTvmiuD4OQg@mail.gmail.com
обсуждение исходный текст
Список pgsql-hackers
Basically,

diff --git a/src/backend/parser/parse_param.c b/src/backend/parser/parse_param.c
index b402843..97064fc 100644
--- a/src/backend/parser/parse_param.c
+++ b/src/backend/parser/parse_param.c
@@ -108,6 +108,9 @@ fixed_paramref_hook(ParseState *pstate, ParamRef *pref)
  ereport(ERROR,
  (errcode(ERRCODE_UNDEFINED_PARAMETER),
  errmsg("there is no parameter $%d", paramno),
+ parstate->numParams == 1 && < It is of pseudo-type record >
+ ? errhint("%s", _("did you incorrectly enclose USING arguments in parentheses?"))
+ : 0
  parser_errposition(pstate, pref->location)));
 
  param = makeNode(Param);


I didn't spend too much time trying to figure out how to test that a parameter is composite/record typed...

I think a false positive on SQL EXECUTE is going to be very small...but I choose here mostly out of ease - a fix in pl/pgsql would be more correct.

David J.

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

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: Notice lock waits
Следующее
От: Tom Lane
Дата:
Сообщение: Re: truncate trigger for foreign data wrappers