Postgres SHOW CREATE TABLE equivalent

Snippet

Sometimes, you want to create a table outside of a database dump import. MySQL has "SHOW CREATE TABLE" and Postgres does not.

However, close enough.

# just the table create command
pg_dump --schema-only --table TABLENAME DATABASE_URL
 
# include all the indices and alter tables and such
pg_dump -st tablename dbname

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.