distal-attribute
distal-attribute
distal-attribute
distal-attribute

Primary Key Not Working

User, date Message
Written by jplandry
1 year ago
Category: General
2 posts since Mon, 22 Oct 12
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.

Sincerely,
~Joe
Written by ansgar
1 year ago
4784 posts since Fri, 07 Apr 06
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.
Written by jplandry
1 year ago
2 posts since Mon, 22 Oct 12
Thank you for the follow-up. I'm glad you were already aware of the issue. Thanks again for all your hard work!
Written by ansgar
1 year ago
4784 posts since Fri, 07 Apr 06
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.
Written by ansgar
1 year ago
4784 posts since Fri, 07 Apr 06
Just fixed that, in r4340.
 

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