snippetsqlMinor
How to dump only create table statements (or table definitions only) with pg_dump in Postgresql
Viewed 0 times
postgresqldumppg_dumpcreatewithstatementshowonlytabledefinitions
Problem
I want only the table definitions, not wiews nor functions.
I have a schema named "cvp". I try:
And I get:
I try also without
I'am using PostgreSQL 11.
I have a schema named "cvp". I try:
pg_dump --schema-only -n cvp -t 'cvp.*' --format plain
And I get:
pg_dump: No matching tables were foundI try also without
-n cvp or changing -t to -t . -t cvp.I'am using PostgreSQL 11.
Solution
I've just tried this:
It nicely exported all table definitions, as expected.
pg_dump -s -t test.* -d testIt nicely exported all table definitions, as expected.
-s is the same as --schema-only.Code Snippets
pg_dump -s -t test.* -d testContext
StackExchange Database Administrators Q#250685, answer score: 3
Revisions (0)
No revisions yet.