randgen team mailing list archive
-
randgen team
-
Mailing list archive
-
Message #00204
Re: [Bug 1074485] Re: Reproducibility issue: stored procedures/functions not correctly prefixed with delimiters in query log
Hi Roel,
Vote: to have this in lib/GenTest/Executor/MySQL.pm,
Just a few suggestions,
Applying your patch noticed that the entire query would be added
DELIMITER before and after with the required syntax, however i had
difficulty using such a queries in MySQL, Also i noticed the query
contained quite a few other parts of SQL like DROP/CALL of procedure
which may not require a DELIMITER, could we instead look at only
isolating the procedure block which requires the delimiter , something like:
if ($query =~ m{CREATE (PROCEDURE|FUNCTION)}sgio) {
my $proc_func_query = $query;
$proc_func_query =~ s/CREATE (PROCEDURE|FUNCTION)/DELIMITER
| CREATE $1/sgio;
$proc_func_query =~ s/END(.*?);/END | DELIMITER ;/sgio;
print "$proc_func_query;\n";
} else {
print "$query;\n";
}
Secondly, since this would apply for both erroneous and non-erroneous queries would it be good to have the condition for the entire sqltrace block instead?
Thanks
Saikumar
On Saturday 03 November 2012 02:36 AM, RoelV wrote:
Proposed patch
=== modified file 'lib/GenTest/Executor/MySQL.pm'
--- lib/GenTest/Executor/MySQL.pm 2012-10-01 09:56:06 +0000
+++ lib/GenTest/Executor/MySQL.pm 2012-11-02 21:05:34 +0000
@@ -645,7 +645,13 @@
$trace_query =~ s/\n/\n# [sqltrace] /g;
print '# [sqltrace] ERROR '.$err.": $trace_query;\n";
} else {
- print "$query;\n";
+ if ($query =~ m{(procedure|function)}sgio) {
+ pring "DELIMITER |\n";
+ print "$query|\n";
+ pring "DELIMITER ;\n";
+ } else {
+ print "$query;\n";
+ }
}
}
Follow ups
References