Avoid schema/catalog sql generation

When you have a blank catalogName/schemaName, the escapeObject method should leave off the schema from the generated SQL.


Are you seeing it added? If so, what database are you using?

Nathan

I was checking how Generator implementations work, and I was wondering how to generate each script without catalog/schema name before object (for, mainly, script generation purposes).


As I can see, every (or almost) implementation of AbstractSqlGenerator.generateSql uses parametrized Database.escapeObjectName to mount final SQL, even when you explicit specify blank catalogName/schemaName in changelog file.

do not explicit declare that tags)

  • set predefined escape character whose will just print object name.
  • What do you think about that implementations? Is there any workaround or extension that I could do?

    I did 3 cases to test behaviour within both names: empty string, space string and without tag, and it still generating schema/catalog name.


    I am using below databases:


    • Sybase (ASE) 15

    Liquibase v3.1.1

    I’ll have to look more into it. Are you able to send the test cases you used?

    Nathan

    I got what happened:


    When using DataBaseFactory#findCorrectDatabaseImplementation method, it binds schema/catalog from jdbc connection to liquibase.database.Database object.


    So I just changed my lookup for implementation by creating my own factory, and SQL are generated pure and clean :slight_smile:


    NOTE: DataBaseFactory#getImplementedDatabases returns all available Database implementations.

    Thanks for the update, sorry I hadn’t gotten to look at it yet. Is your change something that would make sense to move into the general liquibase codebase?


    Nathan

    Good, thanks for the update.


    Nathan

    Actually it was a misuntersood about how generator works, there is not any problem with the code!