postgres-mktempdb
v2019.5.23
Published
make temp postgres database
Downloads
6
Readme
make temp postgres database
Installation
$ [sudo] npm i -g postgres-mktempdb
Scripts usage
command|usage
-|-
mktempdb
|usage: mktempdb [OPTION]...
Examples
$ mktempdb
tmp_LH8LqXy8UGlfMR8zfB3todrc4mwC9Sns
delete temp databases:
$ psql -At -c "SELECT datname FROM pg_database WHERE datname LIKE 'tmp_%'" | xargs -L 1 dropdb
delete temp databases created more than 5 minutes ago:
$ psql -At -c "SELECT datname FROM pg_database
WHERE datname LIKE 'tmp_%' AND (pg_stat_file('base/'||oid||'/PG_VERSION')).modification<now()+interval '5 minutes'" | xargs -L 1 dropdb