warren Asked: 2009-08-31 20:01:30 +0800 CST2009-08-31 20:01:30 +0800 CST 2009-08-31 20:01:30 +0800 CST How can I do a dump of only the table structure in PostgreSQL? 772 In a similar vein to this question, how would I do a schema-only dump in PostgreSQL? backup database restore postgresql schema 2 Answers Voted Best Answer jldugger 2009-08-31T20:19:51+08:002009-08-31T20:19:51+08:00 pg_dump --schema-only arod 2015-05-29T10:22:04+08:002015-05-29T10:22:04+08:00 If you only want the CREATE TABLE statements, then you can do pg_dump -s databasename | awk 'RS="";/CREATE TABLE[^;]*;/'
pg_dump --schema-only
If you only want the
CREATE TABLE
statements, then you can dopg_dump -s databasename | awk 'RS="";/CREATE TABLE[^;]*;/'