Skip to content
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

ActiveRecord 5.1.5 rake db:test:prepare fails with search for postgres #26

Closed
bherrup opened this issue Apr 20, 2018 · 3 comments
Closed

Comments

@bherrup
Copy link

bherrup commented Apr 20, 2018

ActiveRecord::StatementInvalid: PG::InvalidCatalogName: ERROR:  database "postgres" does not exist
:             SELECT t.oid, t.typname
            FROM pg_type as t
            WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'bool')
@Cikey
Copy link
Contributor

Cikey commented May 5, 2018

As a workaround, you can create an empty database postgres. This allows the catalogue lookup to continue. If you have a secure cluster, make sure that your rails user can access the postgres db.

A permanent solution will probably be cockroachdb/cockroach#24735

@phosphor1879
Copy link

I was stuck on this for awhile, not knowing how to even do the workaround, which was made a bit more complicated due to using docker, and not being able to get a cockroachdb binary to run in my alpine rails container. Eventually I went with a workaround in which I added the docker client binary to the image, mounted the docker.sock as a volume, and put this early in my application startup, before any rake db:* commands are executed:

system("docker exec -it #{cockroach_container_name} ./cockroach sql --insecure -e 'CREATE DATABASE postgres'")

@knz
Copy link

knz commented Jun 24, 2018

So you know, the next CockroachDB release will pre-create the postgres database.

@knz knz removed their assignment Jul 21, 2018
@rafiss rafiss closed this as completed May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants