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

fix update() assigning values to columns marked with default #13

Closed

Conversation

nicoulaj
Copy link

This fixes a bug where update() does not exclude generated columns annotated with default attribute, leading to compilation errors when using #[derive(ormx::Table)] with postgres:

error returned from database: column "foo" can only be updated to DEFAULT

@NyxCode
Copy link
Owner

NyxCode commented Jul 19, 2021

Hey, thanks for the PR.
#[ormx(default)] was intended to be used for columns with a default value.
For supporting generated columns, I suggest we introduce an other PG-specific attribute, maybe #[ormx(generated)], which would have the effect you implemented here for #[ormx(default)].

@nicoulaj
Copy link
Author

Is it really PG specific though ? Mysql also has generated columns.

@NyxCode
Copy link
Owner

NyxCode commented Jul 29, 2021

thats possible, never worked with it though.
But as I said, we need to differentiate between default and generated.

@NyxCode
Copy link
Owner

NyxCode commented Sep 21, 2021

@nicoulaj Are you still willing to persue this? I think support for #[ormx(generated)] would be super cool.

@NyxCode NyxCode closed this Sep 8, 2024
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

Successfully merging this pull request may close these issues.

2 participants