ruby - ActiveRecord::StatementInvalid: PG::InternalError expected "]" to end datum -
i'm newbie ruby , using activerecord.
i'm trying create record (i.e. new instance of class) using activerecord. i've created , ran migration, created file:
class createpeople < activerecord::migration def change create_table :people |t| t.string :first_name t.string :last_name t.datetime :birthdate end end end
this model file class called person in it:
class person < activerecord::base end
i went terminal , started irb console command "rake console." tried inputs: person = person.new
, person = person.create(first_name: "dave", last_name: "smith")
. either input gives me error message:
activerecord::statementinvalid: pg::internalerror: error: expected "]" end datum, got "0 0 0 0 ]}) :location 2634}}
eta (full error message):
activerecord::statementinvalid: pg::internalerror: error: expected "]" end datum, got "0 0 0 0 ]}) :location 2634}} :targetlist ({targetentry :expr {var :varno 4 :varattno 1 :vartype 19 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 4 :varoattno 1 :location 2224} :resno 1 :resname schemaname :ressortgroupref 0:resorigtbl 2615 :resorigcol 1: resjunk false} {targetentry :expr {var :varno 3 :varattno 1 :vartype 19 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 3: varattno 1 :location 2257} :resno 2 :resname tablename :ressortgroupref 0 :resorigtbl 1259 :resorigcol 1 :resjunk false} {targetentry :expr {funcexpr :funcid 1645 :funcresulttype 19 :funcretset false :funcvariadic false :funcformat 0: funccollid 0 :inputcollid 0 :args ({var :varno 3: varattno 5 :vartype 26 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 3 : varoattno 5 :location 2305}) :location 2289} :resno 3 :resname tableowner :ressortgroupref 0 :resorigtble 0 :resorigcol 0 :resjunk false} {targetentry :expr {var :varno 6 :varattno 1 :vartype 19 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 6 : varattno 1 :location 2340} :resno 4 :resname tablespace :ressortgroupref 0 :resorigtble 1213 :resorigcol 1 :resjunk false} {targetentry :expr {var :varno 3 :varttno 13 :vartype 16 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 3 :varoattno 13 :location 2373} :resno 5 :resname hasindexes :ressortgroupref 0 :resorigtble 1259 :resorigcol 13 :resjunk false} {targetentry :expr {var :varno 3 :varattno 21 :vartype 16 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 3 :varoattno 21 :location 2410} :resno 6 :resname hasrules :ressortgroupref 0 :resorigtble 1259 :resorigcol 21 :resjunk false} {targetentry :expr {var :varno 3 :varattno 22 :vartype 16 :vartypmod -1 :varcollid 0 :varlevels 0 :varnoold 3 :varoattno 22 :location 2445} :resno 7 :resnmae hastriggers :ressortgroupref 0 :resorigtbl 1259 :resorigcol 22 :resjunk false}} :withcheckoptions <> :returninglist <> :groupclause <> :havingqual <> :windowcaluse <> :distinctclause <> :sortclause <> :limitoffset <> :limitcount <> :rowmarks <> :setoperations <> :constraintdeps <>})”; length = 1 line 2: pg_tables : select tablename pg_tables schemaname = (current_schemas(false)) c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /connection_adapters/postgresql/database_statements.rb:147:in ‘async_exec’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /connection_adapters/postgresql/database_statements.rb:147:in ‘block in query’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /connection_adapters/abstract_adapter.rb:473: in ‘block in log’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.2.1/lib /active_support/notifications/instrumenter.rb:20:in ‘instrument’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /connection_adapters/abstract_adapter.rb:467:in ‘log’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /connection_adapters/postgresql/database_statements.rb:146:in ‘query’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /connection_adapters/postgresql/schema_statements.rb:91:in ‘tables’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /connection_adapters/schema_cache.rb:90:in ‘prepare_tables’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /connection_adapters/schema_cache.rb:22:in ‘table_exists?’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /model_schema.rb:230:in ‘table_exists?’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /attribute_methods/primary_key.rb:97: in ‘get_primary_key’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /attribute_methods/primary_key.rb:95:in ‘reset_primary_key’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /connection_adapters/postgresql/ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /attribute_methods/primary_key.rb:73:in ‘primary_key’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /model_schema.rb:234:in ‘attributes_builder’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /model_schema.rb:254: in ‘_default_attributes’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /core.rb:273:in ‘initialize’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /inheritance.rb:61:in ‘new’ c:/ruby200/lib/ruby/gems/2.0.0/gems/activerecord-4.2.1/lib/active_record /inheritance.rb:61:in ‘new’
as noted m_x, there issue pg setup. there no issue activerecord itself. in order resolve specific statementinvalid error, full uninstall , reinstall needed performed postgresql.
it seemed postgresql's data folder got corrupted in way. uninstalling using control panel or postgresql uninstaller did not uninstall postgresql completely. specifically, postgresql not being uninstalled registry. partial uninstall prevented new data folder postgresql being created correct bin , lib directories within it. these steps needed followed postgresql uninstalled completely:
- uninstall postgresql control panel or postgresql uninstaller within postgresql directory.
- delete postgresql directory folder
- run ccleaner make sure old postgresql registry keys deleted. (free download available here: http://www.filehippo.com/download_ccleaner)
- download , reinstall postgresql
Comments
Post a Comment