ITADN

Migration fails when SQL contains `%` characters

#41Closedjarppe 创建于 2025-01-27
J
jarppecommented
The migration causes a `java.util.UnknownFormatConversionException` exception when SQL contains `%r` characters For example, this SQL can not be migrated: ```sql create or replace function app.claim_next_job(_type text) as $$ declare job_record app.jobs%rowtype; begin ... ``` The problem seems to be in `pg-migration/src/pg/migration/core.clj` at line 408, where the SQL statement is logged using the `log/infof` function. This causes the whole SQL to be passed to `String/format` that tried to apply the `%r` as formatting. I think the `pg.migration.log` needs an `info` function that does not pass the argument to `String/format`, and the SQL statement should be logged using it. A quick workaround could be replacing the line 408 from: ``` (log/infof sql) ``` to: ``` (log/infof "%s" sql) ```
关闭于 2025-01-27 1 条评论