Skip to content

relation "some_table_name" does not exist at character 13 #11

Open
@ramontayag

Description

@ramontayag

I have not gotten to the heart of the matter, but I get this error when running a spec. However, this spec only fails when one before it that uses the same schema is created.

  • Rails 3.2.3
   ActiveRecord::StatementInvalid: PG::Error: ERROR:  relation "asset_groups" does not exist at character 13
: INSERT INTO "asset_groups" ("created_at", "name", "updated_at") VALUES ($1, $2, $3) RETURNING "id"
from /Users/ramon/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:1152:in `get_last_result'

For documentation's sake, here are some guesses as to why this happens:

  • Cached statement does not properly take into account search_path. Because the 2nd spec just truncates the schema, and runs the test on that schema, then perhaps there's some funkiness. This is a wild idea though. I looked at the Rails 3.2.3 code and poked around but did not get far.
  • The schema truncation within a transaction does some funky stuff to the state of the db.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions