Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql ActiveRecord::语句无效:PG::SyntaxError:错误_Postgresql_Ruby On Rails 4 - Fatal编程技术网

Postgresql ActiveRecord::语句无效:PG::SyntaxError:错误

Postgresql ActiveRecord::语句无效:PG::SyntaxError:错误,postgresql,ruby-on-rails-4,Postgresql,Ruby On Rails 4,从Ruby 2.5.5升级到Ruby 2.7.3之后,我的测试套件中出现了这个错误 ActiveRecord::StatementInvalid:PG::SyntaxError:ERROR:SyntaxError:at或附近的语法错误:“ if!是空的吗? in_where_子句=(1)为什么使用双插值?你可以说ARRAY[#{ids.join(',')}]?(2) 你不能说deals.id=any(数组[…])而不是复杂的存在吗?(3) where子句中的最后看起来像什么? if !ids.e

从Ruby 2.5.5升级到Ruby 2.7.3之后,我的测试套件中出现了这个错误
ActiveRecord::StatementInvalid:PG::SyntaxError:ERROR:SyntaxError:at或附近的语法错误:“

if!是空的吗?
in_where_子句=(1)为什么使用双插值?你可以说
ARRAY[#{ids.join(',')}]
?(2) 你不能说
deals.id=any(数组[…])
而不是复杂的存在吗?(3) where子句中的
最后看起来像什么?
if !ids.empty?
  in_where_clause = <<~SQL
    EXISTS ( SELECT 1 FROM
     ( SELECT id FROM unnest(#{"ARRAY[#{ids.join(',')}]"}::int[]) id ) temp_ids
     WHERE temp_ids.id = deals.id )
  SQL
end