stripComments:true on SQL changesets incorrectly looks inside of values
Description
Environment
Windows Server 2012 running under Cygwin
Activity
Show:
Details
Details
Reporter
Damon Overboe
Damon OverboeComponents
Affects versions
Priority
Created March 5, 2014 at 5:40 PM
Updated March 5, 2014 at 5:40 PM
I have not verified if this is an issue running under Windows normally, but I suspect it fails there as well.
If you have a record in a SQL changeset that includes '--' in the value, stripComments:true removes everything after that. Changing the flag to false works around the issue.
For example, a changeset with this insert command (mixed in with other successful commands) will cause liquibase to complain about the SQL formatting:
--liquibase formatted sql
--changeset test:123 endDelimiter:\nGO stripComments:true
INSERT [dbo].[tableA] ([id], [description]) VALUES (N'id1', N'description with --sql comment flag')
INSERT [dbo].[tableA] ([id], [description]) VALUES (N'id2', N'description without sql comment flag')
GO
Error:
Liquibase update Failed: Migration failed for change set test.sql::123::test:
Reason: liquibase.exception.DatabaseException: Error executing SQL INSERT [dbo].[tableA] ([id], [description]) VALUES (N'id1', N'description with
INSERT [dbo].[tableA] ([id], [description]) VALUES (N'id2', N'description without sql comment flag'): Incorrect syntax near 'id2'.
For what it's worth, Notepad++ marks the script up correctly, and liquibase performs the import correctly when stripComments is set to false, so I think the stripComments is just being a bit greedy on SQL changesets.