Re: pg_dump include/exclude fails to error

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: pg_dump include/exclude fails to error
Date: 2024-03-10 15:51:19
Message-ID: CAFj8pRBVC0urVkfu1Lh=zFUDSkWZ9ax7hFpg8pxKja6qc=poWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

ne 10. 3. 2024 v 15:23 odesílatel Magnus Hagander <magnus(at)hagander(dot)net>
napsal:

> When including tables with the new pg_dump functionality, it fails to
> error out if a table is missing, but only if more than one table is
> specified.
>
> E.g., if table foo exist, but not bar:
>
> pg_dump --table bar
> pg_dump: error: no matching tables were found
>
> with file "myfilter" containing just "table bar"
> pg_dump --filter myfilter
> pg_dump: error: no matching tables were found
>
> with the file "myfilter" containing both "table foo" and "table bar"
> (order doesn't matter):
> <no error, but dump of course only contains foo>
>

is not this expected behaviour (consistent with -t option)?

(2024-03-10 16:48:07) postgres=# \dt
List of relations
┌────────┬──────┬───────┬───────┐
│ Schema │ Name │ Type │ Owner │
╞════════╪══════╪═══════╪═══════╡
│ public │ foo │ table │ pavel │
└────────┴──────┴───────┴───────┘
(1 row)

pavel(at)nemesis:~/src/orafce$ /usr/local/pgsql/master/bin/pg_dump -t foo -t
boo > /dev/null
pavel(at)nemesis:~/src/orafce$

if you want to raise error, you should to use option --strict-names.

pavel(at)nemesis:~/src/orafce$ /usr/local/pgsql/master/bin/pg_dump -t foo -t
boo --strict-names > /dev/null
pg_dump: error: no matching tables were found for pattern "boo"

Regards

Pavel

>
> Not having looked into the code, but it looks to me like some variable
> isn't properly reset, or perhaps there is a check for existence rather
> than count?
>
> //Magnus
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2024-03-10 15:57:22 Re: Statistics Import and Export
Previous Message Dean Rasheed 2024-03-10 15:22:49 Re: MERGE ... RETURNING