pgsql: pg_dump: Fix incorrect parsing of object types in pg_dump --filt

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_dump: Fix incorrect parsing of object types in pg_dump --filt
Date: 2025-08-08 05:38:14
Message-ID: E1ukFny-001L9t-1U@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_dump: Fix incorrect parsing of object types in pg_dump --filter.

Previously, pg_dump --filter could misinterpret invalid object types
in the filter file as valid ones. For example, the invalid object type
"table-data" (likely a typo for the valid "table_data") could be
mistakenly recognized as "table", causing pg_dump to succeed
when it should have failed.

This happened because pg_dump identified keywords as sequences of
ASCII alphabetic characters, treating non-alphabetic characters
(like hyphens) as keyword boundaries. As a result, "table-data" was
parsed as "table".

To fix this, pg_dump --filter now treats keywords as strings of
non-whitespace characters, ensuring invalid types like "table-data"
are correctly rejected.

Back-patch to v17, where the --filter option was introduced.

Author: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Reviewed-by: Srinath Reddy <srinath2133(at)gmail(dot)com>
Reviewed-by: Daniel Gustafsson <daniel(at)yesql(dot)se>
Discussion: https://postgr.es/m/CAHGQGwFzPKUwiV5C-NLBqz1oK1+z9K8cgrF+LcxFem-p3_Ftug@mail.gmail.com
Backpatch-through: 17

Branch
------
REL_18_STABLE

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

Modified Files
--------------
src/bin/pg_dump/filter.c | 13 ++++++++-----
src/bin/pg_dump/t/005_pg_dump_filterfile.pl | 14 ++++++++++----
2 files changed, 18 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2025-08-08 05:38:27 pgsql: pg_dump: Fix incorrect parsing of object types in pg_dump --filt
Previous Message Fujii Masao 2025-08-08 05:38:00 pgsql: pg_dump: Fix incorrect parsing of object types in pg_dump --filt