pg_dump negation regex
Hello!
I've been looking at the documentation and there seems to be no keyword for
negation purposes.
Am I missing something? Or it's like this?
I'm trying to use pg_dump to create a database skeleton and I have tables
like program_0, program_1, etc. And I'd like to dump all the tables but
client_1 onwards.
Does anybody happen to know a way to accomplish it?
Thank you!
Eudald
On 5/7/20 9:53 AM, Eudald Valcàrcel Lacasa wrote:
Hello!
I've been looking at the documentation and there seems to be no keyword
for negation purposes.Am I missing something? Or it's like this?
https://www.postgresql.org/docs/12/app-pgdump.html
-T pattern
--exclude-table=pattern
Do not dump any tables matching pattern. The pattern is interpreted
according to the same rules as for -t. -T can be given more than once to
exclude tables matching any of several patterns.
When both -t and -T are given, the behavior is to dump just the
tables that match at least one -t switch but no -T switches. If -T
appears without -t, then tables matching -T are excluded from what is
otherwise a normal dump.
For what patterns you can use see:
https://www.postgresql.org/docs/12/app-psql.html#APP-PSQL-PATTERNS
I'm trying to use pg_dump to create a database skeleton and I have
tables like program_0, program_1, etc. And I'd like to dump all the
tables but client_1 onwards.Does anybody happen to know a way to accomplish it?
Thank you!
Eudald
--
Adrian Klaver
adrian.klaver@aklaver.com
I know the -T command, but I'm trying to regex the "pattern" in -T in order
to exclude all tables named program_1 onwards.
I believe commonly you'd use -T "program_!0", but the ! negation keyword is
not defined.
Thanks,
Eudald
El jue., 7 may. 2020 a las 19:36, Adrian Klaver (<adrian.klaver@aklaver.com>)
escribió:
Show quoted text
On 5/7/20 9:53 AM, Eudald Valcàrcel Lacasa wrote:
Hello!
I've been looking at the documentation and there seems to be no keyword
for negation purposes.Am I missing something? Or it's like this?
https://www.postgresql.org/docs/12/app-pgdump.html
-T pattern
--exclude-table=patternDo not dump any tables matching pattern. The pattern is interpreted
according to the same rules as for -t. -T can be given more than once to
exclude tables matching any of several patterns.When both -t and -T are given, the behavior is to dump just the
tables that match at least one -t switch but no -T switches. If -T
appears without -t, then tables matching -T are excluded from what is
otherwise a normal dump.For what patterns you can use see:
https://www.postgresql.org/docs/12/app-psql.html#APP-PSQL-PATTERNS
I'm trying to use pg_dump to create a database skeleton and I have
tables like program_0, program_1, etc. And I'd like to dump all the
tables but client_1 onwards.Does anybody happen to know a way to accomplish it?
Thank you!
Eudald--
Adrian Klaver
adrian.klaver@aklaver.com
On May 7, 2020, at 1:03 PM, Eudald Valcàrcel Lacasa <eudald.valcarcel@gmail.com> wrote:
I know the -T command, but I'm trying to regex the "pattern" in -T in order to exclude all tables named program_1 onwards.
I believe commonly you'd use -T "program_!0", but the ! negation keyword is not defined.Thanks,
Eudald
More like ‘program[^0].*’ of there are no leading zero (e.g.09) or ‘program[1-9][0-9]*'
You're right Rob.
Thanks, it worked!
Eudald
El jue., 7 may. 2020 a las 21:16, Rob Sargent (<robjsargent@gmail.com>)
escribió:
Show quoted text
On May 7, 2020, at 1:03 PM, Eudald Valcàrcel Lacasa <
eudald.valcarcel@gmail.com> wrote:
I know the -T command, but I'm trying to regex the "pattern" in -T in
order to exclude all tables named program_1 onwards.
I believe commonly you'd use -T "program_!0", but the ! negation keyword
is not defined.
Thanks,
EudaldMore like ‘program[^0].*’ of there are no leading zero (e.g.09) or
‘program[1-9][0-9]*'