Primary Key Not Working

jplandry posted 5 years ago in General
I have a few tables in my MS SQL db that I receive '0 rows deleted when that should have been x.'. One of the tables has a VARBINARY field that holds a file, so when the delete command passes through every column value instead of just the primary key. I reached out to you recently and you stated that my table didn't have a primary key and it is programmed to pass each variable if one does not exist.

I looked into this further and the primary key shows up in both Toad and Microsoft SQL DB Editor, but not in HeidiSQL. I have the primary key on my id (integer) field. I tried removing the primary key via Toad and then adding it via HeidiSQL. It saved successfully, but when I reload the DB it is still not showing up with a primary key and I can still not delete any records.

Please let me know if you need additional information to help troubleshoot what I am seeing.I am currently on v7.0.0.4217.

ansgar posted 5 years ago
Yes, seems I just forgot to implement the detection of primary keys on MSSQL, so every UPDATE and DELETE comes with a WHERE clause on all table columns. See issue #2946.
jplandry posted 5 years ago
Thank you for the follow-up. I'm glad you were already aware of the issue. Thanks again for all your hard work!
ansgar posted 5 years ago
Well I did not have the issue in mind, but I stumbled upon it as I searched in tracker for some similar report. There are plenty of reports, and some of them are difficult to read, with totally broken english. But that's mostly not a big deal.
ansgar posted 4 years ago
Just fixed that, in r4340.

Please login to leave a reply, or register at first.