yerassyl
yerassyl

Reputation: 3048

PG::UndefinedColumn: ERROR: column "courseid" of relation "courses" does not exist

I am doing Rails + PostgreSql app. I need to run sql dump on production env. I have courses table with courseID attribute. But when I run my sql I get this error:

PG::UndefinedColumn: ERROR:  column "courseid" of relation "courses" does not exist
LINE 1: INSERT INTO courses (courseID, name, created_at, updated_at)...

Here is how my sql dump looks like:

INSERT INTO course (courseID, name, created_at, updated_at) VALUES
('CSCI150', 'Fundamentals of Programming',
localtimestamp, localtimestamp ),
etc...;

Tried to put quotes (' ') around attributes, didn't help. Strange error. What might cause that? EDIT: Here is what in my schema.rb

  create_table "courses", force: :cascade do |t|
    t.string   "name"
    t.string   "courseID"
    t.integer  "school_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

Upvotes: 0

Views: 1564

Answers (1)

sajinmp
sajinmp

Reputation: 518

All identifiers (including column names) that are not double-quoted are folded to lower case in PostgreSQL. Column names that were created with double-quotes and thereby retained upper-case letters (and/or other syntax violations) have to be double-quoted for the rest of their life. So, yes, PostgreSQL column names are case-sensitive

Read it here

Try changing courseID to lowercase or enclose it in doublequotes in the dump.

Upvotes: 1

Related Questions