Fix parsing of underscores in pg_plan_advice occurrence numbers The pg_plan_advice scanner recognizes underscores as digit separators just like the core parser, but used strtoint() to convert occurrence numbers which does not support underscores. Consequently, advice such as SEQ_SCAN(x#1_0) failed to parse. Fix by using pg_strtoint32_safe() like the core scanner, and also add regression test coverage.
This bug was independently found and reported by Lukas Fittl and Chao Li. Backpatch down to v19 where pg_plan_advice was introduced. Author: Chao Li <[email protected]> Co-authored-by: Daniel Gustafsson <[email protected]> Reported-by: Lukas Fittl <[email protected]> Reported-by: Chao Li <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Reviewed-by: Lukas Fittl <[email protected]> Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/CAP53PkzKeD=t90OfeMsniYrcRe2THQbUx3g6wV17Y=ztiwm...@mail.gmail.com Backpatch-through: 19 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/f87375bfba5cee2dcea4c19879ee990463be9636 Modified Files -------------- contrib/pg_plan_advice/expected/syntax.out | 16 ++++++++++++++++ contrib/pg_plan_advice/pgpa_scanner.l | 17 ++++++++++++----- contrib/pg_plan_advice/sql/syntax.sql | 6 ++++++ 3 files changed, 34 insertions(+), 5 deletions(-)
