howevere when I run liquibase, I get the following error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--liquibase formatted sql
Running the create query in MySQL (5.5.28) works without any problem
I’m using Liquibase for the first time, so I have no idea on what is going wrong here.
Formatted sql changelogs need to start with --liquibase formatted sql as the very first line. Your example had a line before and just one “-” not two. If it doesn’t see that, it assumes it is standard SQL and tries to execute everything including the comments.
SEVERE 28-8-13 8:26:liquibase: Change Set c:/temp/liquibase/liquibase.sql::raw::includeAll failed. Error: Error executing SQL --liquibase formatted sql
--changeset jvddrift:1
create table test1 (
id int primary key,
name varchar(255)
);: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--liquibase formatted sql
);: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--liquibase formatted sql
It still seems to be working fine for me. Can you zip up your actual changelog files and attach them or email them to me at nathan.voxland@liquibase.org?
Thanks, I can reproduce it now. Debugging the code, it looks like a problem with UTF-8 with BOM formatted .sql files. I logged https://liquibase.jira.com/browse/CORE-1434 and applied a fix to the 3.x branch for 3.0.5.
For now, if you convert your sql file to ascii or BOM-less UTF8 it will work just fine.
I’ve also come across this problem. With my senior collgeue’s favor, he put
– changeset db:[…]
in front of every sql script. That makes the problem disappear