On 3/17/26 10:28 AM, Shaheed Haque wrote:
> Hi Adrian,
>
> Thanks for the kind replies, but it seems my email was not very clear...
>
> I was hoping, possibly foolishly, that specifying the wildcard in "--
> table=public.*id_seq" would dump the matched sequences, irrespective of
> whether the associated table data was being dumped. Is there a way to
> get just the sequences?
1) You are using --data-only which means you won't get the sequence
definition, only the statement to set the sequence value:
SELECT pg_catalog.setval('public.seq_test_line_id_seq', 1, false);
If the sequence is not already in the database instance the above will fail.
2) Sequences are an object that can be created as a stand alone which
you then use as needed or more generally these days as a dependent
object to a serial 'type' or a GENERATED ALWAYS AS IDENTITY attribute to
a column. In the latter cases the table needs to exist for the sequence
to have any relevance. In your case I'm thinking that the sequences you
want are tied to tables and in the case where you don't dump the
associated table the sequence data(pg_catalog.setval(...)) is not dumped
as there is no point.
>
> It is very possible that I am barking up the wrong tree with pg_dump,
> and what I need is some queries using the information_schema.
I'm going to say yes you will need to find another method. It would help
to know exactly what it is you want.
>
> Thanks, Shaheed
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>