Skip to content

Instantly share code, notes, and snippets.

@ssinganamalla
Created August 27, 2015 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssinganamalla/d3c053e1c1c04e7455bd to your computer and use it in GitHub Desktop.
Save ssinganamalla/d3c053e1c1c04e7455bd to your computer and use it in GitHub Desktop.
rename database name in postgres
//delete the user sessions
SELECT pg_terminate_backend( pid )
FROM pg_stat_activity
WHERE pid <> pg_backend_pid( )
AND datname = 'oldname';
ALTER DATABASE oldname RENAME TO newname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment