[MASSMAIL] pgsql: Fix ecpg's mechanism for detecting unsupported cases in the gram

Поиск
Список
Период
Сортировка
От Tom Lane
Тема [MASSMAIL] pgsql: Fix ecpg's mechanism for detecting unsupported cases in the gram
Дата
Msg-id E1rsSoi-000Vqb-SU@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix ecpg's mechanism for detecting unsupported cases in the grammar.

ecpg wants to emit a warning if it parses a SQL construct that the
backend can parse but will immediately throw a FEATURE_NOT_SUPPORTED
error for.  The way it was testing for this was to see if the string
ERRCODE_FEATURE_NOT_SUPPORTED appeared anywhere in the gram.y code.
This is, of course, not nearly good enough, as there are plenty of
rules in gram.y that throw that error only conditionally.  There was
a hack dating to 2008 to suppress the warning in one rule that
doesn't even exist anymore, but nothing for other cases we've created
since then.  End result was that you could get "unsupported feature
will be passed to server" warnings while compiling perfectly good SQL
code in ecpg.  Somehow we'd not heard complaints about this, but
it was exposed by the recent addition of an ecpg test for a SQL/JSON
construct.

To fix, suppress the warning if the rule contains any "if" statement.
Manual comparison of gram.y with the generated preproc.y file shows
that the warning is now emitted only in rules where it's sensible.

This problem has existed for a long time, so back-patch to all
supported branches.

Discussion: https://postgr.es/m/603615.1712245382@sss.pgh.pa.us

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/118558e6d46b512d2ba04d7fc799c5750305ce71

Modified Files
--------------
src/interfaces/ecpg/preproc/parse.pl | 37 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 19 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: [MASSMAIL]pgsql: Further cleanup for recent JSON-related commits.
Следующее
От: Robert Haas
Дата:
Сообщение: pgsql: Fix old, misleading comment for PGRES_POLLING_ACTIVE.