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

Autoinc column does not necessarily need to be the first column in the table #398

Closed
jedrz opened this issue Oct 5, 2018 · 2 comments
Closed
Assignees
Labels

Comments

@jedrz
Copy link

jedrz commented Oct 5, 2018

I noticed an error when getting generated key that is not the first column in the table. I think the rs.getObject(1) in the following line https://github.com/JetBrains/Exposed/blob/master/src/main/kotlin/org/jetbrains/exposed/sql/statements/InsertStatement.kt#L27 should be replaced with rs.getObject(firstAutoIncColumn.name).

I think I can provide a corresponding MR with the fix in couple of days. What do you think? The fix seems to be trivial so please let me know if I should do so.

@Tapac
Copy link
Contributor

Tapac commented Oct 18, 2018

Not all database returns ResultSet with named columns, e.g. MySQL throws Column 'id' not found. because name of the column is `GENERATED_KEY. But i'll will try to keep both behaviors.

@Tapac Tapac self-assigned this Oct 18, 2018
@Tapac Tapac added the bug label Oct 18, 2018
@Tapac Tapac closed this as completed Oct 18, 2018
@jedrz
Copy link
Author

jedrz commented Oct 20, 2018

Thank you fixing this issue!

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