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

Wrong query on update #1613

Closed
jhnferraris opened this issue Aug 8, 2016 · 1 comment
Closed

Wrong query on update #1613

jhnferraris opened this issue Aug 8, 2016 · 1 comment
Labels

Comments

@jhnferraris
Copy link

I'm trying to update a record using .update method

 knex("places")
        .update({ groupId: group.id })
        .where('id', place.id);

When I executed the script, migration error. When I checked the query log, there is a missing clause "columnToBeUpdate = value" that causes the bug.

The query:

 "update "places" set  where "id" = $1"

Is this true for all or I've missed an updated documentation when executing an update?

@jhnferraris
Copy link
Author

Turns out I did miss something.

group is empty, that's why it was skipped.

Maybe we can have an error handling here if all of the parameters were skipped before executing the actual query?

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

No branches or pull requests

2 participants