From 91788ee4dea30d5034ec726605ea7e607dc4c7cf Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 18 Nov 2026 06:27:30 +0000 Subject: [PATCH] Fix read-only table test without requiring SUPER privilege Creating a trigger fails with ERROR 1419 when binary logging is enabled and the test user lacks the SUPER privilege. Trigger the update error via a unique key conflict instead. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UWTd5qRHChT2dgTfE2dswC --- features/search-replace.feature | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/features/search-replace.feature b/features/search-replace.feature index 5123dded..b087778d 100644 --- a/features/search-replace.feature +++ b/features/search-replace.feature @@ -1579,9 +1579,8 @@ Feature: Do global search/replace @require-mysql Scenario: Warn when updating a table fails due to a database error Given a WP install - And I run `wp db query "CREATE TABLE wp_readonly_test ( id int(11) unsigned NOT NULL AUTO_INCREMENT, data TEXT, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"` - And I run `wp db query "INSERT INTO wp_readonly_test (data) VALUES ('old-value');"` - And I run `wp db query "CREATE TRIGGER prevent_update BEFORE UPDATE ON wp_readonly_test FOR EACH ROW SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Table is read-only';"` + And I run `wp db query "CREATE TABLE wp_readonly_test ( id int(11) unsigned NOT NULL AUTO_INCREMENT, data VARCHAR(191), PRIMARY KEY (id), UNIQUE KEY data (data) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"` + And I run `wp db query "INSERT INTO wp_readonly_test (data) VALUES ('old-value'), ('new-value');"` When I try `wp search-replace old-value new-value --all-tables-with-prefix` Then STDERR should contain: @@ -1590,5 +1589,5 @@ Feature: Do global search/replace """ And STDERR should contain: """ - Table is read-only + Duplicate entry """