-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flush of AWS database not working #16
Comments
Try psql command maybe.
|
I am thinking this is because there may be existing transactions that are not closed, therefore the flush command cannot proceed (according to this StackOverflow). The SELECT pg_terminate_backend(pid) FROM pg_stat_activity; However, we get the following error:
I couldn't make ALTER USER dj_hetmech WITH SUPERUSER; Turns out AWS does not allow users superuser access. I was able to get the command to work by omitting termination of SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE usename <> 'rdsadmin'; This booted me from my |
Trying from within a DROP DATABASE IF EXISTS dj_hetmech; Returned:
Therefore, I try the
This fails with error:
|
I tried method from https://dba.stackexchange.com/a/163668: -- Connecting to the current user localhost's postgres instance
psql
-- Making sure the database exists
SELECT * FROM pg_database WHERE datname = 'dj_hetmech';
-- Disallow new connections
UPDATE pg_database SET datallowconn = 'false' WHERE datname = 'dj_hetmech';
ALTER DATABASE dj_hetmech CONNECTION LIMIT 1;
-- Terminate existing connections
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'dj_hetmech';
-- Drop database
DROP DATABASE dj_hetmech; Only got to terminate existing connections, then psql disconnected from the database. Now when I try to connect in a new
This is probably because I changed the connection limit. @dongbohu, I may need you to take over here. |
Okay @dongbohu rebooted the database, allowing me to login and remove the connection limit: ALTER DATABASE dj_hetmech CONNECTION LIMIT -1; Then I could run -- Switch to postgres database
\connect postgres
DROP DATABASE dj_hetmech; Then we ran the following to recreate the database:
|
Notes: next time the method in #16 (comment) may work, however, we must not run the command from the |
SuccessFor #18, I used the following workflow to delete the database and recreate an empty one: -- Switch to postgres database (or set --db-user to connect directly to it)
\connect postgres
-- Terminate existing dj_hetmech connections
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'dj_hetmech';
-- Drop dj_hetmech database
DROP DATABASE dj_hetmech;
-- Create an empty dj_hetmech database
CREATE DATABASE dj_hetmech; |
Whenever the database is repopulated (or at least the past two times), the read_only_user doesn't have any permissions for the database In the current version of the database read_only_user works fine after manually adding permissions, but I think there should be a way to add permissions automatically when reloading the database |
I am attempting to wipe the prototype database and re-populate it using the new
hetmatpy
version added in #15.However, the following command seems to run indefinitely without returning or erroring:
When the database was a local postgres instance in a Docker, this command took at most a few seconds. @dongbohu any ideas?
The text was updated successfully, but these errors were encountered: