Skip to content

Instantly share code, notes, and snippets.

@tylerfontaine
Created August 19, 2020 18:16
Show Gist options
  • Save tylerfontaine/153f9030e611d97cef5bb02ed3809e2c to your computer and use it in GitHub Desktop.
Save tylerfontaine/153f9030e611d97cef5bb02ed3809e2c to your computer and use it in GitHub Desktop.
Copy Table(s) from one database to another
LOAD DATABASE
FROM postgresql://postgres:password@localhost/postgres
INTO postgresql://postgres:password@localhost/testdb-copy
WITH include drop, create tables, schema only
including only table names matching 'test' in schema 'public'
AFTER LOAD DO
$$ SELECT create_hypertable('test', 'time') $$ ;
LOAD DATABASE
FROM postgresql://postgres:password@localhost/postgres
INTO postgresql://postgres:password@localhost/testdb-copy
WITH data only
including only table names matching 'test' in schema 'public';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment