cc-d/ieddit

Postgres recreate_psql commands not working properly

Closed this issue · 2 comments

stets commented

I am running postgres inside a container -- I manually ran the recreate_psql_db.sh commands inside of the container and hit quite a few errors with roles existing and other things:

test=# \connect ieddit;
You are now connected to database "ieddit" as user "test".
ieddit=# DROP SCHEMA public CASCADE;
DROP SCHEMA
ieddit=# CREATE SCHEMA public;
CREATE SCHEMA
ieddit=# GRANT ALL ON SCHEMA public TO postgres;
ERROR:  role "postgres" does not exist
ieddit=# GRANT ALL ON SCHEMA public TO public;
GRANT
ieddit=# COMMENT ON SCHEMA public IS 'standard public schema';
COMMENT
ieddit=# CREATE USER test WITH PASSWORD 'test';
ERROR:  role "test" already exists
ieddit=# ALTER SCHEMA public OWNER to postgres;
ERROR:  role "postgres" does not exist
cc-d commented

Right. So this is another issue caused by assuming the environment will be setup on debian, which sets up a postgres user by default.

The error regarding a user already existing can be ignored.

stets commented

fixed with #29