簡體   English   中英

Hstore Postgres Rails4的語法錯誤

[英]syntax error with hstore postgres Rails4

嗨,我遇到了Postgres語法錯誤,使用HSTORE時似乎無法追蹤到

錯誤:

2.0.0p247 :021 > e.save                                                                                                                                                                                                                        
   (218.8ms)  BEGIN                                                                                                                                                                                                                            
  SQL (219.8ms)  INSERT INTO "communications" ("created_at", "incoming", "properties", "type", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"  [["created_at", Thu, 19 Sep 2013 23:49:14 EST +10:00], ["incoming", true], ["propertie
s", "{\"to\":\"First email test!\"}"], ["type", "Email"], ["updated_at", Thu, 19 Sep 2013 23:49:14 EST +10:00]]                                                                                                                                
PG::InternalError: ERROR:  Syntax error near 'e' at position 13                                                                                                                                                                                
: INSERT INTO "communications" ("created_at", "incoming", "properties", "type", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"                                                                                                       
   (218.4ms)  ROLLBACK 

當我嘗試保存電子郵件記錄時,該錯誤來自Rails控制台,在我的應用程序中,電子郵件繼承自Communication模型,並且記錄存儲在數據庫的“ communications”表中。

楷模:

class Communication < ActiveRecord::Base
    belongs_to :patient
    belongs_to :practice
end

和...

class Email < Communication
    store_accessor :properties, :to, :cc, :bcc, :message, :subject
end

不知道為什么,但是幾天后數據庫或服務器重新啟動可能已解決了問題……非常感謝您的協助@ user647622

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM