Passing env variables to <sql> change type

hello all

does someone have the right example how to use env variables in sql injection inside liquibase xml file?

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

 

    <changeSet id="customer-change-287" author="vkvsuser">
<comment>Grant permissions to secret user</comment>
<sql>
            GRANT SELECT ON TABLE email_audit TO ${app_db_user};
</sql>
<rollback>
<sql>
                REVOKE SELECT ON TABLE email_audit FROM ${app_db_user};
</sql>
</rollback>
</changeSet>

 

</databaseChangeLog>

If I use like that I see

liquibase.exception.DatabaseException: Error executing SQL GRANT SELECT ON TABLE email_audit TO ${app_db_user}: ERROR: syntax error at or near "$"

Use liquibase-maven-plugin 3.2.2

You need to provide the value for “app_db_user” at run-time. I don’t know how to use Maven, but here is the CLI example:

./liquibase --username=XYZ --password=ABC --url=“connection-string” --changeLogFile=“example-changelog.sql” --logLevel=info update -Dapp_db_user=BOB

I pass a variable to the docker environment. Isn’t the problem that LiquiBase isn’t processing the variable?

many thanks

it was fixed from 3.10.3