IntelliJ IDEA:如何在不插入串联运算符的情况下编写SQL注释?

时间:2019-01-26 03:19:42

标签: postgresql intellij-idea

我将DDL数据库作为Flyway脚本编写在.sql文件中,IDEA对此非常了解。我在IDEA中选择了Postgres方言,因此它完全理解Postgres SQL的所有关键字,功能和特殊性。

数据库注释对象除外-与SQL注释相对,它很好理解。

每当我尝试编写多行注释对象时,IDEA就会感到困惑,并尝试插入连接运算符-||

因此,如果我编写此代码并将光标留在引号内(因为IDEA会自动完成字符串):

comment on column table_x.column_y is 'first line'

然后按Enter,IDEA尝试通过将代码更新为以下内容来提供帮助:

comment on column table_x.table_y is 'first line' ||
  ''

但是该SQL无效,您不能在那里使用串联运算符(postgres将给出syntax error at or near "||")。

多行Postgres注释必须是其中之一,从而导致注释字符串的串联:

comment on column table_x.table_y is 'first line' 
  'second line'

或这样,将导致嵌入新行:

comment on column table_x.table_y is 'first line
second line'

我试图关闭SQL意图Split string literal,但似乎并没有改变这种行为。

在IDEA中是否可以更改任何选项,以使其在编写多行注释对象时不会受到干扰?

编辑: IDEA版本是2018.3.3 idea.log文件中没有任何相关内容。 现在Issue存在于该问题。

enter image description here

1 个答案:

答案 0 :(得分:0)

关闭在Enter上插入字符串串联,关闭enter image description here