繁体   English   中英

Postgres hstore和rails的语句无效

[英]Invalid statement with Postgres hstore and rails

我正在使用带有rails 3.2的activerecord-postgres-hstore gem。 我已经设置了hstore,当我尝试保存任何数据时,我收到错误:

ActiveRecord::StatementInvalid in ProductsController#create

PG::Error: ERROR:  Syntax error near 'a' at position 4
: INSERT INTO "products" ("created_at", "name", "price", "properties", "updated_at")      
VALUES ($1, $2, $3, $4, $5) RETURNING "id"

在这种情况下,我将'properties'定义为hstore数据类型。 我已经在postgresl 8.4和9.1中看到了这个错误。 任何信息赞赏。

Rails 3.2添加代码“serialize:data,ActiveRecord :: Coders :: Hstore” Postgres保存错误“ActiveRecord :: StatementInvalid:PG ::错误:错误:位置 5''T '附近的语法错误”解决了我的问题。 当我最初尝试将其作为修复程序时,我的模型名称错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM