我想在我的flyway迁移文件中对SQL进行换行,工作版本如下:
comment on table account is
'Multiple users may be associated with the same account (think multiple login methods, like gmail + facebook, etc.) ';
如果我使用IDEA并在字符串中按Enter键,则会生成:
comment on table account is
'Multiple users may be associated with the same account (think multiple' ||
' login methods, like gmail + facebook, etc.) ';
但是,然后运行迁移操作会产生错误PSQLException: ERROR: syntax error at or near "||"
。
版本:Flyway 4.2,Postgres 10
答案 0 :(得分:1)
在SQL中跨行分割字符串是完全没问题的(没有任何连接运算符):
comment on table account is
'Multiple users may be associated with the
same account (think multiple login methods,
like gmail + facebook, etc.)';
答案 1 :(得分:0)
仅包装源代码的替代答案,而不是字符串的内容:
comment on table account is
'Multiple users may be associated with the same account (think multiple'
' login methods, like gmail + facebook, etc.)';