-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR with ActiveRecord::loadDefaultValues(), id serial and posgresql #3564
Comments
can you please post the complete CREATE TABLE statement? |
sure CREATE TABLE tbl_mytable |
In general, PKs should not have default values. |
I didn't set any default value. My create statement is in above comment. |
looks like serial is implemented via default value internally in postgres. |
@makroxyz I am not saying you did wrong. ;) I mean in our core code when loading table schema, we should not load default values for PK columns. This needs to be fixed (not your code.) Sorry for confusion. |
@qiangxue I didn't understand I did wrong! :) I just want to give more infos ;) Another thing: should I open a new issue? |
yes please. |
I'm still having this error after $model->loadDefaultValues() $column->defaultValue is loaded in loadColumnSchema function. The fix doesn't unset defaultValue if column is PK... |
Thanks! Should be fixed now. |
… take default values from schema
using $model->loadDefaultValues() where model ID is serial, throws this error:
ERROR: invalid input syntax for integer: "nextval('tbl_mytable_id_seq'"
The text was updated successfully, but these errors were encountered: