Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PG::UndefinedObject: ERROR: type "serial" does not exist #17

Open
BroiSatse opened this issue Aug 29, 2017 · 4 comments
Open

PG::UndefinedObject: ERROR: type "serial" does not exist #17

BroiSatse opened this issue Aug 29, 2017 · 4 comments

Comments

@BroiSatse
Copy link

Hi all,

I am having some issues with serial type lately. Problem reflects in some changes in the schema file that cannot be loaded later on, failing wiht exception:

PG::UndefinedObject: ERROR:  type "serial" does not exist
LINE 1: SELECT 'serial'::regtype::oid
               ^
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:61:in `async_exec'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:61:in `block (2 levels) in query'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/dependencies/interlock.rb:46:in `block in permit_concurrent_loads'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/concurrency/share_lock.rb:185:in `yield_shares'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/dependencies/interlock.rb:45:in `permit_concurrent_loads'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:60:in `block in query'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:612:in `block (2 levels) in log'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:611:in `block in log'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:603:in `log'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:59:in `query'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/database_statements.rb:70:in `query_value'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql/quoting.rb:81:in `lookup_cast_type'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/quoting.rb:114:in `quote_default_expression'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql/quoting.rb:71:in `quote_default_expression'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/schema_creation.rb:17:in `quote_default_expression'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/schema_creation.rb:103:in `add_column_options!'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/connection_adapters/abstract_adapter.rb:42:in `block in add_column_options!'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:54:in `call_implementation'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:84:in `_modware_continue'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:76:in `_modware_call'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:43:in `execute'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:19:in `start'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_monkey-2.1.5/lib/schema_monkey/stack.rb:34:in `start'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/connection_adapters/abstract_adapter.rb:41:in `add_column_options!'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql/schema_creation.rb:10:in `add_column_options!'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/schema_creation.rb:34:in `visit_ColumnDefinition'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/schema_creation.rb:14:in `accept'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/schema_creation.rb:45:in `block in visit_TableDefinition'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/schema_creation.rb:45:in `map'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/schema_creation.rb:45:in `visit_TableDefinition'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/connection_adapters/abstract_adapter.rb:48:in `block in visit_TableDefinition'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:54:in `call_implementation'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:84:in `_modware_continue'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:76:in `_modware_call'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:43:in `execute'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:19:in `start'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_monkey-2.1.5/lib/schema_monkey/stack.rb:34:in `start'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/connection_adapters/abstract_adapter.rb:47:in `visit_TableDefinition'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/schema_creation.rb:14:in `accept'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:288:in `create_table'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/connection_adapters/abstract_adapter.rb:28:in `block in create_table'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:54:in `call_implementation'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:84:in `_modware_continue'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:76:in `_modware_call'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:43:in `execute'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:19:in `start'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_monkey-2.1.5/lib/schema_monkey/stack.rb:34:in `start'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/connection_adapters/abstract_adapter.rb:27:in `create_table'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/migration.rb:849:in `block in method_missing'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/migration.rb:818:in `block in say_with_time'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/migration.rb:818:in `say_with_time'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/migration.rb:838:in `method_missing'
/home/broisatse/work/Hubbado/hubbadoproto/db/schema.rb:20:in `block in <main>'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/schema.rb:48:in `instance_eval'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/schema.rb:48:in `define'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/schema.rb:44:in `define'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/schema.rb:7:in `block in define'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:54:in `call_implementation'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:84:in `_modware_continue'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:76:in `_modware_call'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:43:in `execute'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/modware-0.1.3/lib/modware/stack.rb:19:in `start'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_monkey-2.1.5/lib/schema_monkey/stack.rb:34:in `start'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/schema_plus_core-2.1.1/lib/schema_plus/core/active_record/schema.rb:6:in `define'
/home/broisatse/work/Hubbado/hubbadoproto/db/schema.rb:13:in `<main>'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/bootsnap-1.1.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/bootsnap-1.1.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:286:in `block in load'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:258:in `load_dependency'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:286:in `load'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/tasks/database_tasks.rb:233:in `load_schema'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/tasks/database_tasks.rb:255:in `block in load_schema_current'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/tasks/database_tasks.rb:304:in `block in each_current_configuration'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/tasks/database_tasks.rb:303:in `each'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/tasks/database_tasks.rb:303:in `each_current_configuration'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/tasks/database_tasks.rb:254:in `load_schema_current'
/home/broisatse/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/railties/databases.rake:248:in `block (3 levels) in <main>'
/home/broisatse/.rvm/gems/ruby-2.4.1@global/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'

Below is bit of the schema without schema_plus_pg_indexes (first table - backtrace points to this create_table call):

  create_table "acquired_certifications", id: :serial, force: :cascade do |t|
    t.date "date"
    t.date "expires"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer "contractor_id"
    t.integer "certification_id"
    t.string "reference"
    t.index ["certification_id"], name: "index_acquired_certifications_on_certification_id"
    t.index ["contractor_id"], name: "index_acquired_certifications_on_contractor_id"
  end

and the same table with the gem active:

  create_table "acquired_certifications", id: :serial, default: %q{nextval('acquired_certifications_id_seq'::regclass)}, force: :cascade do |t|
    t.date     "date"
    t.date     "expires"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "contractor_id",    :index=>{:name=>"index_acquired_certifications_on_contractor_id"}
    t.integer  "certification_id", :index=>{:name=>"index_acquired_certifications_on_certification_id"}
    t.string   "reference"
  end

Any idea what could be causing that problem?

@olkeene
Copy link

olkeene commented Dec 11, 2017

Got the same. Ping @ronen

@ronen
Copy link
Member

ronen commented Dec 11, 2017

@olkeene
Copy link

olkeene commented Dec 11, 2017

@ronen I've tried that, no luck

@ronen
Copy link
Member

ronen commented Dec 11, 2017

@olkeene sorry I hate to say this, but my more-or-less stock answer for schema_plus things these days: Unfortunately i'm not currently using ruby on rails in any of my jobs, and unfortunately i don't currently have the spare time to devote to it. I'm happy to accept PRs, but can't do more than provide minimal advice; and even then I'm often embarrasingly slow to respond. I'd be thrilled to have more active collaborators (there are a few of us, but all seem to be in the same boat).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants