From: | Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com> |
---|---|
To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Bug in pg_dump --filter? - Invalid object types can be misinterpreted as valid |
Date: | 2025-08-02 16:14:19 |
Message-ID: | CAFC+b6rJneLNpAgan1ofvUvSHsVD-Xi5b-mhkszetPzU3RfVbQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Aug 2, 2025 at 3:18 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> Hi,
>
> It looks like pg_dump --filter can mistakenly treat invalid object types
> in the filter file as valid ones. For example, the invalid type
> "table-data"
> (probably a typo for "table_data") is incorrectly recognized as "table",
> and pg_dump runs without error when it should fail.
>
> --------------------------------------------
> $ cat filter.txt
> exclude table-data one
>
> $ pg_dump --filter filter.txt
> --
> -- PostgreSQL database dump
> --
> ...
>
> $ echo $?
> 0
> --------------------------------------------
>
> This happens because pg_dump (filter_get_keyword() in pg_dump/filter.c)
> identifies tokens as sequences of ASCII alphabetic characters, treating
> non-alphabetic characters (like hyphens) as token boundaries. As a result,
> "table-data" is parsed as "table".
>
> To fix this, I've attached the patch that updates pg_dump --filter so that
> it treats tokens as strings of non-space characters separated by spaces
> or line endings, ensuring invalid types like "table-data" are correctly
> rejected. Thought?
>
> With the patch:
> --------------------------------------------
> $ cat filter.txt
> exclude table-data one
>
> $ pg_dump --filter filter.txt
> pg_dump: error: invalid format in filter read from file "filter.txt"
> on line 1: unsupported filter object type: "table-data"
> --------------------------------------------
>
>
Hi Fujii-san , +1 for the patch , I have reviewed and tested it and LGTM.
--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2025-08-02 18:25:30 | Re: Remove INT64_HEX_FORMAT and UINT64_HEX_FORMAT |
Previous Message | Jeff Davis | 2025-08-02 15:34:32 | Re: pg_dump --with-* options |