Is there a workaround for JDBC w/liquibase and MySQL session variables & client side SQL instructions
- by David
Slowly building a starter changeSet xml file for one of three of my employer's primary schema's. The only show stopper has been incorporating the sizable library of MySQL stored procedures to be managed by liquibase.
One sproc has been somewhat of a pain to deal with: The first few statements go like
use TargetSchema;
select "-- explanatory inline comment thats actually useful --" into vDummy;
set @@session.sql_mode='TRADITIONAL' ;
drop procedure if exists adm_delete_stats ;
delimiter $$
create procedure adm_delete_stats(
...rest of sproc
I cut out the use statement as its counter-productive, but real issue is the set @@session.sql_mode statement which causes an exception like
liquibase.exception.MigrationFailedException: Migration failed for change set ./foobarSchema/sprocs/adm_delete_stats.xml::1293560556-151::dward_autogen dward:
Reason: liquibase.exception.DatabaseException: Error executing SQL ...
And then the delimiter statement is another stumbling block.
Doing do dilligence research I found this rejected MySQL bug report here and this MySQL forum thread that goes a little bit more in depth to the problem here.
Is there anyway I can use the sproc scripts that currently exist with Liquibase or would I have to re-write several hundred stored procedures?
I've tried createProcedure, sqlFile, and sql liquibase tags without much luck as I think the core issue is that set, delimiter, and similar SQL commands are meant to be interpreted and acted upon by the client side interpreter before being delivered to the server.