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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.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
Ruby PostgreSQL activerecord的怪异性。最大_Ruby_Postgresql_Activerecord - Fatal编程技术网

Ruby PostgreSQL activerecord的怪异性。最大

Ruby PostgreSQL activerecord的怪异性。最大,ruby,postgresql,activerecord,Ruby,Postgresql,Activerecord,在保存之前,我有一个ActiveRecord方法抛出了一个奇怪的错误: class MyThing < ActiveRecord::Base before_save :dostuff def dostuff p self.class.maximum(:mycolumn) end end .maximum方法在dostuff方法之外工作,所以我想我只是一下子要求太多了?在保存前,是否有其他方法获取在中工作的整数列的最大值?错误消息是关于最大标识符长度,对象名称(表、列

在保存之前,我有一个ActiveRecord
方法抛出了一个奇怪的错误:

class MyThing < ActiveRecord::Base
  before_save :dostuff

  def dostuff
    p self.class.maximum(:mycolumn)
  end
end

.maximum
方法在
dostuff
方法之外工作,所以我想我只是一下子要求太多了?在保存前,是否有其他方法获取在
中工作的整数列的最大值?

错误消息是关于最大标识符长度,对象名称(表、列等)的最大长度。它与SQL函数MAX()无关。看起来您使用的名称无效,超过63个字符。

看起来问题实际上是因为我在迁移过程中使用了一些PostgreSQL不友好的术语,这意味着所需的表实际上不存在。非常奇怪的错误消息,考虑到…
PGError: ERROR: current transaction is aborted, commands ignored until end of transaction block : SHOW max_identifier_length