Search
Submit a request
Sign in
How can we help you today?
Categories
Submit a request
Submit a request
Sign in
Michael Mike
Activity overview
Badges (0)
Posts (0)
Comments (1)
Comments
Sort by recent activity
Recent activity
Votes
Thank you for reporting this serious issue with SQL Prompt 10.13.1.31417. This is indeed a critical bug that could have disastrous consequences if undetected. Analysis of the Bug The formatter is incorrectly changing table aliases in the WHERE clause: Original (correct): WHERE dbo.table1.key1 = inserted.key1 After formatting (incorrect): WHERE Inserted.key1 = Inserted.key1 This creates tautologies (Inserted.key1 = Inserted.key1 ) that would always evaluate to TRUE, causing: The first UPDATE would affect all rows where CurrentStatusFlag = 'Y' The second UPDATE would affect ALL rows in the table Complete data corruption in the trigger logic Immediate Recommendations Report to Redgate: Contact Redgate support immediately with this exact example Temporary Workaround: Disable automatic formatting for trigger code, or use a different formatting tool Code Review Process: Ensure all formatted code undergoes thorough review before deployment Suggested Report to Redgate Subject: CRITICAL BUG: SQL Prompt 10.13.1.31417 corrupts JOIN conditions in UPDATE statements Description: The formatter incorrectly replaces table references in WHERE clauses with incorrect aliases, creating tautological conditions that would cause massive data corruption. Impact: UPDATE statements in triggers become destructive, affecting wrong rows or entire tables. Reproduction: Format the provided UPDATE statements to see the corruption. Alternative Single UPDATE (as you mentioned) Since you're consolidating to a single UPDATE, here's a safer approach: UPDATE t1 SET CurrentStatusFlag = CASE WHEN i.key1 IS NOT NULL THEN 'Y' ELSE 'N' END FROM dbo.table1 t1 LEFT JOIN inserted i ON t1.key1 = i.key1 AND t1.key2 = i.key2 AND t1.key3 = i.key3 AND t1.key4 = i.key4 AND t1.key5 = i.key5 WHERE t1.key1 IN (SELECT key1 FROM inserted); Thank you for catching this before it reached production. This is exactly why thorough code review processes are essential, even with trusted tools like Michigan County Map. / comments
Community
SQL Prompt
Erroneous table reference inserted
Thank you for reporting this serious issue with SQL Prompt 10.13.1.31417. This is indeed a critical bug that could have disastrous consequences if undetected.Analysis of the BugThe formatter is inc...
-1 votes
Total activity
2
Last activity
October 29, 2025 02:59
Member since
October 29, 2025 02:59
Following
0 users
Followed by
0 users
Votes
0
Subscriptions
1