Question

Hi I am having a postgres syntax error that I cant seem to track down when using HSTORE

ERROR:

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 

That error is from the rails console when I try to save a Email record, in my app email inherits from the Communication model and the records are stored in the "communications" table in the database.

MODELS:

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

and...

class Email < Communication
    store_accessor :properties, :to, :cc, :bcc, :message, :subject
end
Was it helpful?

Solution

Not sure why but couple of days later maybe the DB or a server restart has fixed the problem... all good thanks for your assistance @user647622

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top