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

Use returning * when doing inserts for sqlite #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dghaehre
Copy link

@dghaehre dghaehre commented Nov 8, 2023

When running db/insert you expect to get back what you have inserted or updated. But since the return value is currently based on sqlite3/last-insert-rowid there is a case where the return value is unexpected. This edge case has been captured in the added tests.

You first insert two rows.
And then run another insert with on conflict where you only end up updating the first row you inserted. You expect to get back the row you modified, but before this change you will get back the second row.

There is one breaking change here, which is that if you do an insert where nothing is modified, you will get back nil. I think that makes sense.

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.

1 participant