You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using FlyWay 10.13.0 community, Java API client, MariaDB 10.6.16, running on MacOS (I don't think this one's relevant though).
I'm running the following migration:
CREATETABLETABLE1
(
id INT auto_increment NOT NULL,
tenantId INTNOT NULL,
CONSTRAINT TABLE1_PK PRIMARY KEY (id)
);
CREATETABLETABLE2
(
userId varchar(100) NOT NULL,
tenantId INTNOT NULL,
CONSTRAINT TABLE2_PK PRIMARY KEY (userId, tenantId)
);
CREATE OR REPLACETRIGGERTABLE1_before_insert
BEFORE INSERT
ON TABLE1
FOR EACH ROW
BEGIN
IF NOT EXISTS(SELECTut.tenantIdFROM TABLE2 ut WHEREut.tenantId=NEW.tenantIdANDut.userId= @param_user_id)
THEN
SIGNAL SQLSTATE '45000'SET MESSAGE_TEXT ='Not allowed';
END IF;
END
And it fails with the following:
org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: Script V01__bug.sql failed
--------------------------
SQL State : 42000
Error Code : 1064
Message : (conn=4) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 9
Location : /Users/peto/Documents/src/emark/inphinity-app/sql-script-test/src/test/resources/flyway-bug/V01__bug.sql (/Users/peto/Documents/src/emark/inphinity-app/sql-script-test/src/test/resources/flyway-bug/V01__bug.sql)
Line : 15
Statement : CREATE OR REPLACE TRIGGER TABLE1_before_insert
BEFORE INSERT
ON TABLE1
FOR EACH ROW
BEGIN
IF NOT EXISTS(SELECT ut.tenantId FROM TABLE2 ut WHERE ut.tenantId = NEW.tenantId AND ut.userId = @param_user_id)
THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Not allowed'
at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:387)
at org.flywaydb.core.internal.command.DbMigrate.lambda$applyMigrations$1(DbMigrate.java:277)
at org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:59)
at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:276)
at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:249)
at org.flywaydb.core.internal.command.DbMigrate.lambda$migrateAll$0(DbMigrate.java:144)
at org.flywaydb.database.mysql.MySQLNamedLockTemplate.execute(MySQLNamedLockTemplate.java:62)
at org.flywaydb.database.mysql.MySQLConnection.lock(MySQLConnection.java:154)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:149)
at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:144)
at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:102)
at org.flywaydb.core.Flyway.lambda$migrate$0(Flyway.java:211)
at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:210)
at org.flywaydb.core.Flyway.migrate(Flyway.java:156)
at xyz.inphinity.sql.TestFlywayOnMariaDB.testFlyway(TestFlywayOnMariaDB.java:37)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException: Script V01__bug.sql failed
--------------------------
SQL State : 42000
Error Code : 1064
Message : (conn=4) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 9
Location : /Users/peto/Documents/src/emark/inphinity-app/sql-script-test/src/test/resources/flyway-bug/V01__bug.sql (/Users/peto/Documents/src/emark/inphinity-app/sql-script-test/src/test/resources/flyway-bug/V01__bug.sql)
Line : 15
Statement : CREATE OR REPLACE TRIGGER TABLE1_before_insert
BEFORE INSERT
ON TABLE1
FOR EACH ROW
BEGIN
IF NOT EXISTS(SELECT ut.tenantId FROM TABLE2 ut WHERE ut.tenantId = NEW.tenantId AND ut.userId = @param_user_id)
THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Not allowed'
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:252)
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:214)
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:136)
at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeOnce(SqlMigrationExecutor.java:69)
at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.lambda$execute$0(SqlMigrationExecutor.java:61)
at org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:31)
at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:60)
at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:379)
... 17 more
Caused by: java.sql.SQLSyntaxErrorException: (conn=4) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 9
at org.mariadb.jdbc.export.ExceptionFactory.createException(ExceptionFactory.java:289)
at org.mariadb.jdbc.export.ExceptionFactory.create(ExceptionFactory.java:378)
at org.mariadb.jdbc.message.ClientMessage.readPacket(ClientMessage.java:172)
at org.mariadb.jdbc.client.impl.StandardClient.readPacket(StandardClient.java:915)
at org.mariadb.jdbc.client.impl.StandardClient.readResults(StandardClient.java:854)
at org.mariadb.jdbc.client.impl.StandardClient.readResponse(StandardClient.java:773)
at org.mariadb.jdbc.client.impl.StandardClient.execute(StandardClient.java:697)
at org.mariadb.jdbc.Statement.executeInternal(Statement.java:1035)
at org.mariadb.jdbc.Statement.execute(Statement.java:1165)
at org.mariadb.jdbc.Statement.execute(Statement.java:493)
at org.flywaydb.core.internal.jdbc.JdbcTemplate.executeStatement(JdbcTemplate.java:210)
at org.flywaydb.core.internal.sqlscript.ParsedSqlStatement.execute(ParsedSqlStatement.java:88)
at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:209)
... 23 more
Seems to me that issue #2666 is either back or wasn't fixed quite correctly. (The script works when launched through other tool, IntelliJ IDEA's DB query console in my case).
The text was updated successfully, but these errors were encountered:
Using FlyWay 10.13.0 community, Java API client, MariaDB 10.6.16, running on MacOS (I don't think this one's relevant though).
I'm running the following migration:
And it fails with the following:
Seems to me that issue #2666 is either back or wasn't fixed quite correctly. (The script works when launched through other tool, IntelliJ IDEA's DB query console in my case).
The text was updated successfully, but these errors were encountered: