代码之家  ›  专栏  ›  技术社区  ›  Shorn

Intellij理念:我如何在不插入串联运算符的情况下编写SQL注释?

  •  0
  • Shorn  · 技术社区  · 6 年前

    我写数据库 DDL 作为Flyway脚本 .sql 文件,这个想法很好理解。我在思想上选择了Postgres方言,使它充分理解Postgres SQL的所有关键字、功能和特性。

    除了数据库注释对象——与它理解良好的SQL注释相反。

    每当我试图写一个多行注释对象时,IDEA就会感到困惑,并试图插入containation操作符。- || .

    因此,如果我写下这个命令,并且光标留在引号内(因为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版本为2018.3.3 IDEA.LOG文件中没有相关内容。 Issue 现在问题已经存在了。

    enter image description here

    1 回复  |  直到 6 年前
        1
  •  0
  •   moscas    6 年前

    转弯 按Enter键插入字符串连接 远离的 enter image description here