Bugzilla – Attachment 183748 Details for
Bug 40292
SQL syntax error when upgrading to 25.05 on MariaDB 10.3, RENAME COLUMN unsupported
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40292: (follow-up) Add xt test to prevent future occurences
Bug-40292-follow-up-Add-xt-test-to-prevent-future-.patch (text/plain), 3.51 KB, created by
Martin Renvoize (ashimema)
on 2025-07-03 11:55:55 UTC
(
hide
)
Description:
Bug 40292: (follow-up) Add xt test to prevent future occurences
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-07-03 11:55:55 UTC
Size:
3.51 KB
patch
obsolete
>From ad8055748572f986869a61042af0fc43b3eb75d3 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Thu, 3 Jul 2025 12:55:25 +0100 >Subject: [PATCH] Bug 40292: (follow-up) Add xt test to prevent future > occurences > >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > xt/check_db_revs_sql_syntax.t | 83 +++++++++++++++++++++++++++++++++++ > 1 file changed, 83 insertions(+) > create mode 100755 xt/check_db_revs_sql_syntax.t > >diff --git a/xt/check_db_revs_sql_syntax.t b/xt/check_db_revs_sql_syntax.t >new file mode 100755 >index 00000000000..b229803e2fc >--- /dev/null >+++ b/xt/check_db_revs_sql_syntax.t >@@ -0,0 +1,83 @@ >+#!/usr/bin/perl >+ >+# Copyright 2025 Koha Development Team >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More; >+use File::Find; >+use File::Slurp; >+ >+# Test for Bug 40292: Prevent SQL syntax error when upgrading to 25.05 on MariaDB 10.3 >+# This test ensures that database revision files don't use SQL syntax that is incompatible >+# with older MariaDB versions (specifically MariaDB 10.3) >+ >+my @db_rev_files; >+my $db_revs_dir = 'installer/data/mysql/db_revs'; >+ >+# Skip test if db_revs directory doesn't exist >+if ( !-d $db_revs_dir ) { >+ plan skip_all => "Database revisions directory ($db_revs_dir) not found"; >+} >+ >+# Find all .pl files in the db_revs directory >+find( >+ sub { >+ push @db_rev_files, $File::Find::name if /\.pl$/; >+ }, >+ $db_revs_dir >+); >+ >+# Skip test if no database revision files found >+if ( !@db_rev_files ) { >+ plan skip_all => "No database revision files found in $db_revs_dir"; >+} >+ >+plan tests => scalar @db_rev_files; >+ >+foreach my $file (@db_rev_files) { >+ my $content = read_file($file); >+ >+ # Check for incompatible RENAME COLUMN syntax >+ # MariaDB 10.3 doesn't support "RENAME COLUMN old_name TO new_name" >+ # but does support "CHANGE COLUMN old_name new_name datatype" >+ my $has_incompatible_syntax = 0; >+ my @problem_lines; >+ >+ my @lines = split /\n/, $content; >+ for my $line_num (0..$#lines) { >+ my $line = $lines[$line_num]; >+ >+ # Look for RENAME COLUMN syntax (case insensitive) >+ # This regex matches: RENAME COLUMN old_name TO new_name >+ if ( $line =~ /\bRENAME\s+COLUMN\s+\w+\s+TO\s+\w+/i ) { >+ $has_incompatible_syntax = 1; >+ push @problem_lines, sprintf("Line %d: %s", $line_num + 1, $line); >+ } >+ } >+ >+ if ($has_incompatible_syntax) { >+ fail("$file contains incompatible RENAME COLUMN syntax"); >+ diag("Found incompatible SQL syntax in $file:"); >+ diag($_) for @problem_lines; >+ diag("Use 'CHANGE COLUMN old_name new_name datatype' instead of 'RENAME COLUMN old_name TO new_name'"); >+ diag("This syntax is required for MariaDB 10.3 compatibility (Bug 40292)"); >+ } else { >+ pass("$file uses compatible SQL syntax"); >+ } >+} >\ No newline at end of file >-- >2.50.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40292
:
183706
|
183747
|
183748
|
183749
|
183750
|
183754
|
183775
|
183777
|
183778
|
183779