This question already has answers here:
Are PostgreSQL column names case-sensitive?
                                
                                    (3个答案)
                                
                        
                                2年前关闭。
            
                    
我正在尝试运行这个非常简单的查询

unless ram.blank?
      list = list.where(['numRam >= ?', ram])
end


它在我使用mysql作为数据库的本地服务器上完美运行,但是在使用psql的生产环境中却出现了此错误

2017-05-07 11:13:57 UTC ERROR:  column "numram" does not exist at character 68
2017-05-07 11:13:57 UTC STATEMENT:  SELECT COUNT(*) FROM "mobiles" WHERE "mobiles"."visible" = $1 AND (numRam >= '5')


显然,它已将numRam更改为numram,这在我的数据库中不存在。有什么解决办法吗?

最佳答案

试试这个技巧:

unless ram.blank?
  list = list.where(['"numRam" >=?', ram])
end

10-02 22:43