This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
postgresql [2022-08-28 12:07:16] mi [Copy DB on same host] |
postgresql [2022-11-15 10:42:52] (current) mi [Vacuum tables 1 at a time] |
||
|---|---|---|---|
| Line 59: | Line 59: | ||
| </code> | </code> | ||
| + | ===== Rename and comments ===== | ||
| + | |||
| + | <code bash>oldname=old_db_name; newname=new_db_name; comment="some description ..." | ||
| + | dropdb -U postgres --if-exists -i $newname | ||
| + | psql -U postgres -c "ALTER database $oldname RENAME TO $newname;" | ||
| + | # or with comment | ||
| + | psql -U postgres -c "ALTER database $oldname RENAME TO $newname; COMMENT ON DATABASE $newname IS '$comment'" | ||
| + | </code> | ||
| ====== Backups ====== | ====== Backups ====== | ||