Sql 在deeplink中将jsonb转换为bigint时出现问题

Sql 在deeplink中将jsonb转换为bigint时出现问题,sql,postgresql,deeplink,Sql,Postgresql,Deeplink,在相同的DB中进行铸造时工作良好,但在使用deeplink时失败 在同一数据库中工作正常(通过此查询获得结果): 连接其他数据库(使用deeplink)时不工作(此查询出错): 错误: ERROR: syntax error at or near "id" LINE 3: ...ECT id, total_inventory, hotel_id, (room_type -> 'id')::bigi...

在相同的DB中进行铸造时工作良好,但在使用deeplink时失败

在同一数据库中工作正常(通过此查询获得结果):

连接其他数据库(使用deeplink)时不工作(此查询出错):

错误:

ERROR:  syntax error at or near "id"
LINE 3: ...ECT id, total_inventory, hotel_id, (room_type -> 'id')::bigi...
                                                             ^
SQL state: 42601
Character: 221

您需要将单引号加倍以避免此类错误:

dblink('demopostgres',
       'SELECT . . . (room_type -> ''id'')::bigint as room_type_id . . . '
      )
问题是一个简单的解析错误。单引号结束字符串,因此出现错误。双单引号是将单引号放入字符串的标准方式,尽管不同的数据库通常支持其他方法(如反斜杠)

ERROR:  syntax error at or near "id"
LINE 3: ...ECT id, total_inventory, hotel_id, (room_type -> 'id')::bigi...
                                                             ^
SQL state: 42601
Character: 221
dblink('demopostgres',
       'SELECT . . . (room_type -> ''id'')::bigint as room_type_id . . . '
      )