Joined October 2014
·

sai ch

India
·

Hi,
I am try PG array with Rails 4, this is very interesting to do in rails.but i got struck in below error
<br/>
addcolumn :courses, :userid, :integer, array: true, null: false, default: '{}'
</br>
for the above data type I'm getting DatatypeMismatch

PG::DatatypeMismatch: ERROR: column "user_id" is of type integer[] but default expression is of type integer

HINT: You will need to rewrite or cast the expression.

if I made changes like integer to text then error message is
PG::InvalidTextRepresentation at /courses

ERROR: malformed array literal: "1" DETAIL: Array value must start with "{" or dimension information.

Achievements
1 Karma
0 Total ProTip Views