agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix parsing of underscores in pg_plan_advice occurrence numbers
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix parsing of underscores in pg_plan_advice occurrence numbers
@ 2026-07-19 21:29 Daniel Gustafsson <dgustafsson@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Daniel Gustafsson @ 2026-07-19 21:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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 <lic@highgo.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reported-by: Lukas Fittl <lukas@fittl.com>
Reported-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Lukas Fittl <lukas@fittl.com>
Discussion: https://postgr.es/m/22E2ECE0-B768-43D5-8575-61C3EBC2E4E8@gmail.com
Discussion: https://postgr.es/m/CAP53PkzKeD=t90OfeMsniYrcRe2THQbUx3g6wV17Y=ZtiwmWTQ@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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix parsing of underscores in pg_plan_advice occurrence numbers
@ 2026-07-19 21:30 Daniel Gustafsson <dgustafsson@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Daniel Gustafsson @ 2026-07-19 21:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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 <lic@highgo.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Reported-by: Lukas Fittl <lukas@fittl.com>
Reported-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Lukas Fittl <lukas@fittl.com>
Discussion: https://postgr.es/m/22E2ECE0-B768-43D5-8575-61C3EBC2E4E8@gmail.com
Discussion: https://postgr.es/m/CAP53PkzKeD=t90OfeMsniYrcRe2THQbUx3g6wV17Y=ZtiwmWTQ@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/dfde93581dcfab7509b6b28863c5270eb8d94754

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-07-19 21:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-07-19 21:29 pgsql: Fix parsing of underscores in pg_plan_advice occurrence numbers Daniel Gustafsson <dgustafsson@postgresql.org>
2026-07-19 21:30 pgsql: Fix parsing of underscores in pg_plan_advice occurrence numbers Daniel Gustafsson <dgustafsson@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox