wasshiwa
wasshiwa

Reputation: 296

Strange PostgreSQL errors when trying to start a rails server on Mac OS X

I want to get a rails application working with PostgreSQL, but something strange is happening. My friends were able to install PostgreSQL and execute:

sudo su
su postgres
createdb development

followed by

rails server

with no bugs. However, when I try to do that, I get a strange error:

/Users/user/.rvm/gems/ruby-1.9.3-p194/gems/activerecord 3.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:1151:in `async_exec': PG::Error: ERROR:  relation "reports" does not exist (ActiveRecord::StatementInvalid) 

LINE 4:              WHERE a.attrelid = '"reports"'::regclass
                                    ^
:             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
          FROM pg_attribute a LEFT JOIN pg_attrdef d
            ON a.attrelid = d.adrelid AND a.attnum = d.adnum
         WHERE a.attrelid = '"reports"'::regclass
           AND a.attnum > 0 AND NOT a.attisdropped
         ORDER BY a.attnum

Note that "reports" is a model in the application.

For what it's worth, the database.yml file looks like this:

development:
  adapter: postgresql
  encoding: unicode
  database: development
  pool: 5
  username: postgres
  password: post

(I don't know what pool means, but I have already set my postgres password to be post)

Upvotes: 0

Views: 828

Answers (2)

wildplasser
wildplasser

Reputation: 44250

WHERE a.attrelid = '"reports"'::regclass ... has too many quotes. It should be WHERE a.attrelid = 'reports'::regclass ...

Upvotes: 0

Rob d'Apice
Rob d'Apice

Reputation: 2416

Have you run rake db:migrate?

Upvotes: 2

Related Questions