Skip to content
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

Default values not set for non-primary-key uuid columns #827

Open
mpkhr opened this issue Feb 5, 2024 · 0 comments
Open

Default values not set for non-primary-key uuid columns #827

mpkhr opened this issue Feb 5, 2024 · 0 comments

Comments

@mpkhr
Copy link

mpkhr commented Feb 5, 2024

I have a non-PK uuid field some_other_id that is either set by application logic or otherwise defaults to gen_random_uuid on database level (just like the primary id works too). I observed the following bevahior:

  • If some_other_id is nil, I receive a not-null error from the database
  • If I exclude that column through columns = MyModel.column_names - ["some_other_id"] the function seems executed, but then I cannot pass a value (i.e. the non-defaulting case)

With this observation the current behavior seems like a bug to me.

I saw there is an open PR #802 which addresses it:
:omit_columns_with_default_functions | true/false|false | Automatically omit columns that have a default function defined in the schema, such as non-PK uuid columns. But I'm not sure if it allows to still pass a value.

Can this issue be fixed?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant