【发布时间】:2014-10-25 02:28:04
【问题描述】:
我是 Postgres 的新手,我正在开发一个现有的 Laravel 应用程序。条目表使用名为data 的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)
我不知道为什么,谁能解释一下这个问题?
【问题讨论】:
标签: php sql postgresql laravel eloquent