postgresqlflyway

Postgres/Flyway: How can I wrap long constant strings in sql file?


I want to line wrap the SQL in my flyway migration file, the working version looks like:

comment on table account is
'Multiple users may be associated with the same account (think multiple login methods, like gmail + facebook, etc.) ';

If I use IDEA and hit enter within the string it generates this:

comment on table account is
'Multiple users may be associated with the same account (think multiple' ||
' login methods, like gmail + facebook, etc.) ';

But then running the migrate operation gives the error PSQLException: ERROR: syntax error at or near "||".

Versions: Flyway 4.2, Postgres 10


Solution

  • It's perfectly fine to split a string across lines in SQL (without any concatenation operator):

    comment on table account is
    'Multiple users may be associated with the 
    same account (think multiple login methods, 
    like gmail + facebook, etc.)';