public inbox for [email protected]
help / color / mirror / Atom feedFrom: Adrian Klaver <[email protected]>
To: Shaheed Haque <[email protected]>
To: pgsql-general list <[email protected]>
Subject: Re: Can I use pg_dump to save a sequence for a table that is not also being saved?
Date: Tue, 17 Mar 2026 07:37:02 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAHAc2jdyYM4U3Ts6Hed8GVYWMgNPo=kaBc3QpC5XoHEZ_5YAag@mail.gmail.com>
References: <CAHAc2jdyYM4U3Ts6Hed8GVYWMgNPo=kaBc3QpC5XoHEZ_5YAag@mail.gmail.com>
On 3/17/26 6:58 AM, Shaheed Haque wrote:
> Hi,
>
> I observe when using pg_dump like this:
>
> pg_dump -h localhost -p 5432 -U dbcoreuser -Ft -f abc.tar --no-
> privileges --data-only \
>
> --exclude-table="public.(jobs|queues|results) \
>
> --table=public.django_migrations \
>
> --table=public.paiyroll_input \
>
> --table=public.*_id_seq \
>
> --verbose foo
>
>
> that the dumped data contains the content of the two tables, and the two
> sequences. (FWIW, the above command is actually submitted via a Python
> subprocess call, so quoting should not be an issue). The verbose output
> confirms this:
>
> pg_dump: processing data for table "public.django_migrations"
> pg_dump: processing data for table "public.paiyroll_input"
> pg_dump: executing SEQUENCE SET django_migrations_id_seq
> pg_dump: executing SEQUENCE SET paiyroll_input_id_seq
>
>
> Note that the instance "foo" contains many other tables, whose sequences
> I was expecting to be included. To confirm this, if I drop the second
> "--table", the verbose log shows only:
>
> pg_dump: processing data for table "public.django_migrations"
> pg_dump: executing SEQUENCE SET django_migrations_id_seq
>
>
> My conclusion is that - despite what I understood from the pg_dump docs
> - the use of "--table=public.*id_seq" does not include all the sequences
> in fo, only those named by another --table.
>
> Did I misunderstand, or formulate the command incorrectly?
My bet is this due to a dependency of paiyroll_input_id_seq on
public.paiyroll_input.
Provide the output, in psql, of:
\d public.paiyroll_input
>
> Thanks, Shaheed
--
Adrian Klaver
[email protected]
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Can I use pg_dump to save a sequence for a table that is not also being saved?
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox