Reputation: 31
I am on Chapter 7 of Agile Web Development with Rails (4th edition), and when I run rake test:units, I get the following error:
rake aborted!
PG::Error: ERROR: invalid value for parameter "search_path": "public"
DETAIL: schema "public" does not exist
: SET search_path TO public
Tasks: TOP => db:test:load => db:test:purge
(See full trace by running task with --trace)
I am on a MacBook Pro with OSX 10.7.4. I have Ruby 1.9.3, Rails 3.1.0, Rake 0.9.2.2, and PostgreSQL 9.1. My production, development, and test databases all exist, have been migrated to, and match the names, user, and password in my config/database.yml file. The schema for all of them is public.
Can anyone help me?
Upvotes: 3
Views: 8552
Reputation: 1436
Make sure that your user default database has a public schema.
For example, if you connect to your database using the user "postgres", then there should be a database named "postgres" with a schema named "public".
Upvotes: 4
Reputation: 53
From http://www.postgresql.org/docs/9.1/static/infoschema-schemata.html (emphasis my own):
The view schemata contains all schemas in the current database that are owned by a currently enabled role.
If you are connecting with a user other than the default user (postgres
), the public
schema may not show. (Yes, even if that user created and owns the database, the public
schema is owned by postgres
[1].)
[1] http://archives.postgresql.org/pgsql-general/2008-10/msg01320.php
Upvotes: 2
Reputation: 656481
According to the error message, the schema public
does not exist. Did you check, that it is there? It is just another schema that can be dropped like any other.
Upvotes: 1