Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liquibase sql comment validation bug #5602

Open
1 of 2 tasks
mgvenkateshbabu opened this issue Feb 17, 2024 · 2 comments
Open
1 of 2 tasks

Liquibase sql comment validation bug #5602

mgvenkateshbabu opened this issue Feb 17, 2024 · 2 comments

Comments

@mgvenkateshbabu
Copy link

Search first

  • I searched and no similar issues were found

Description

A sql view with block comments containing
-- Comments :
had run successfully in Liquibase 4.3.5. We are trying to migrate to new version of Liquibase 4.25.1. We are getting the error

liquibase.exception.SetupException: Unexpected formatting in formatted changelog '<FILE_NAME_REMOVED>sql' at line 16. Formatted SQL changelogs require known formats, such as '--comment ' and others to be recognized and run. Learn all the options at https://docs.liquibase.com/concepts/changelogs/sql-format.html at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:756) at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:508) at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:390) at

Steps To Reproduce

Input file:

--liquibase formatted sql
--never change the value of author:changsetid
--changeset views:VW_DIM stripComments:false runOnChange:true
--Database.ANALYTICS.VW_DIM source

CREATE
OR REPLACE VIEW VW_DIM
/*******************************************************************
-- View name: VW_DIM
-- Layer : Analytics
-- Owner :
-- Version :
-- Created by :
-- Created on :
-- Reviewed by :
-- Purpose :
-- Comments :
-- JIRA story/incident link :
-- Revision history :
Sl No. Date Author Changelog

*******************************************************************/

AS(

--
Run this against liquibase validate and it fails

Expected/Desired Behavior

Validation should have passed

Liquibase Version

4.25.1

Database Vendor & Version

snowflake

Liquibase Integration

CLI

Liquibase Extensions

No response

OS and/or Infrastructure Type/Provider

No response

Additional Context

Looks like this issue or a variation of this issue was fixed in earlier version as reported in
#3017
Probably fixed for --comment but not for -- Comments :

Thanks anyway for the good tool which makes our life easier

Are you willing to submit a PR?

  • I'm willing to submit a PR (Thank you!)
@tati-qalified
Copy link
Contributor

Hi @mgvenkateshbabu, thank you for reporting this issue.

This is a weird one - I used the changelog you provided and tested some variations, and it only happens when using exactly -- Comments :.
Here are other similar expressions that I tested and did not fail:

  • --Comments: (no space before the colon)
  • -- Comment :
  • -- Commentaaaa : (any string afterwards)
  • -- Comments (no colon)

It's clearly some edge case that wasn't covered in the code.
The good news is that you can easily work around it by using any of the variations on the list above.

If you want, you could create a PR and propose a fix for this! Our dev team will be available if you need any guidance.

Thank you,
Tatiana

@mgvenkateshbabu
Copy link
Author

Good Morning,
Thanks for your analysis and workaround solution. We will try to modify the comments and try to run and report back if it success or not.
If time permits, I will try to create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Open Issues
Development

No branches or pull requests

3 participants