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

update/set with Optional fields can lead to an SQL error #68

Closed
scalexm opened this Issue Dec 23, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@scalexm

scalexm commented Dec 23, 2015

How to reproduce the bug:

#[changeset_for(foo)]
struct Foo {
    field1: i64,
    field2: Option<i16>,
    field3: i16,
}

/* ... */

update(
    foo::table.filter(foo::id.eq(&1))
).set(&Foo {
    field1: 0,
    field2: None,
    field3: 0,
}).execute(&conn).unwrap();

This yields the following error:
ERROR: syntax error at or near "field3"
LINE 1: UPDATE "foo" SET "field1" = $1"field3" = $2

It seems that there is a comma missing in the SQL output with patterns like (Something, None, ..., None, Something)

@sgrif sgrif self-assigned this Dec 23, 2015

@sgrif sgrif added this to the 0.4 milestone Dec 23, 2015

@sgrif sgrif closed this in 397fcc0 Dec 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment