Postgres/Flyway:如何在 sql 文件中包装长常量字符串?
Postgres/Flyway: How can I wrap long constant strings in sql file?
我想在我的 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 并在字符串中按回车键,它会生成以下内容:
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
在 SQL 中跨行拆分字符串完全没问题(没有任何连接运算符):
comment on table account is
'Multiple users may be associated with the
same account (think multiple login methods,
like gmail + facebook, etc.)';
仅包装源代码而不是字符串内容的替代答案:
comment on table account is
'Multiple users may be associated with the same account (think multiple'
' login methods, like gmail + facebook, etc.)';
我想在我的 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 并在字符串中按回车键,它会生成以下内容:
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
在 SQL 中跨行拆分字符串完全没问题(没有任何连接运算符):
comment on table account is
'Multiple users may be associated with the
same account (think multiple login methods,
like gmail + facebook, etc.)';
仅包装源代码而不是字符串内容的替代答案:
comment on table account is
'Multiple users may be associated with the same account (think multiple'
' login methods, like gmail + facebook, etc.)';