question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ignore autoinc column on update

See original GitHub issue

We are ignoring autoinc column for inserts, we could to the same for updates. Either like this:

FoobarTable.filter(_.id === someFoobar.id).update(someFoobar)

where newRow’s autoinc column is automatically excluded or even like this

FoobarTable.update(someFoobar)

where it is automatically used as a discriminator (as requested in #570).

Issue Analytics

  • State:open
  • Created 10 years ago
  • Reactions:4
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
qamar2commented, Nov 5, 2017

Apparently, it’s still missing even in 3.2.1. Is there is any hope that it’ll show up in the next release?

3reactions
gonmarquescommented, Feb 21, 2017

It’s still not clear - at least to me - if this issue is really an improvement or if it should have been labeled with some higher priority instead.

True fact is that Slick is generating erroneous SQL for a very specific RDBMS - SQLServer in this case - and such problematic generation could well be avoided using the metadata we have in our hands.

It may well be the very legitimate case to put the responsibility on the user. After all he/she is defining an action that instructs Slick to update all the record’s columns. But on the other hand, we know before hand that auto-inc columns are probably to be left untouched - especially in this case where erroneous SQL is generated for this particular RDBMS.

We should also no forget that - as @cvogt mentions in the first comment - we are already “ignoring autoinc column for inserts”. In order to keep things consistent, shouldn’t this update() action also exclude auto-inc columns?

Should this be enough to force a new Release Candidate for 3.2.0? I understand that the combination of Slick + SQLServer + need for the update() action probably represents a little percentage of the overall use cases, but nevertheless it feels like something is being released with a well known issue left unresolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

tell mysql to ignore updates/inserts for auto increment values
Is there a way to tell mysql to ignore any tentative to assign any value to an auto-increment column?. We are using slick...
Read more >
Avoiding auto-increment holes on InnoDB with INSERT IGNORE
A simple INSERT IGNORE query creates gaps for every ignored insert, ... ON DUPLICATE KEY UPDATE produce gaps on the auto_increment column.
Read more >
13.2.7.2 INSERT ... ON DUPLICATE KEY UPDATE Statement
If a table contains an AUTO_INCREMENT column and INSERT ... ON DUPLICATE KEY UPDATE inserts or updates a row, the LAST_INSERT_ID() function returns...
Read more >
How to update an existing row in the table when you do insert.
ON DUPLICATE KEY UPDATE always increments the auto-increment column by 1. ... If you use INSERT IGNORE, the existing record is updated anyway....
Read more >
INSERT ON DUPLICATE KEY UPDATE - MariaDB
It returns the column values from the INSERT portion of the statement. This function is particularly useful for multi-rows inserts. The IGNORE and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found