0
我是Postgres的新手,我正在研究现有的Laravel应用程序。条目表使用名为data
的hstore
列。这是有问题的查询:Postgres Aggregate Hstore
$query = \DB::table('entries')
->where('f_id', '=', $f->id)
->where('s_id', '=', \Config::get('s_id'))
->select(\DB::raw('SUM(CAST("data"->\'total\' as decimal)) as "total"'))
->get();
我可以看到他们在这里做什么,但这段代码失败,出现错误:
SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type numeric: \"\" (SQL: select SUM(CAST(\"data\"->'total' as decimal)) as \"total\" from \"entries\" where \"f_id\" = 70 and \"s_id\" = 1)
我想不通为什么,任何人都可以解释问题?
我打算接受这个,因为这实际上解决了我的问题。非常感谢 – outrunthewolf 2014-09-01 10:33:32