Sidekiq PG::UndefinedColumn: ERROR: does not exist

Luigi

I made a migration changing branch to branch_name for my phone_contact model. I then changed my code to this:

class ContactWorker
  include Sidekiq::Worker


  def perform(record, service_type = 'test', list_type = 'test')
    phone_contact = PhoneContact.create(
        client_id: record['ClientID'],
        client_name: record['ClientName'],
        branch_id: record['branchID'],
        branch_name: record['branch'],
        unit_id: record['UnitID'],
        member_id: record['MemberID'],
        first_name: record['FirstName'],
        last_name: record['LastName'],
        date_of_birth: record['DateofBirth'],
        most_recent_join_date: record['ChangeDate'],
        old_membership_type: record['OldMembershipType'],
        membership_type: record['NewMembershipType'],
        phone_number: record['HomePhone'],
        email: record['EMailAddress'],
        visits: record['ID__Visits'],
        primary_language: record['PrimaryLanguage'],
        call_type: record['CallType'],
        list_id: "#{Time.new.strftime("%Y_%m_%d")}_#{service_type}_#{list_type}"
    )
  end
end

As you can see, branch is no longer listed. It clearly states branch_name:.

So I pass in a record, which is a hash with all of the above attributes to this worker. Regardless of what that hash looks like, this is the error I receive:

"error_message"=>"PG::UndefinedColumn: ERROR: column \"branch\" of relation \"phone_contacts\" does not exist\nLINE 1: INSERT INTO \"phone_contacts\" (\"branch\", \"branch_id\", \"call_t...\n
^\n: INSERT INTO \"phone_contacts\" (\"branch\", \"branch_id\", \"call_type\", \"client_id\", \"client_name\", \"created_at\", \"date_of_birth\", \"email\", \"first_name\", \"last_name\", \"list_id\", \"member_id\", \"membership_type\", \"most_recent_join_date\", \"old_membership_type\", \"phone_number\", \"primary_language\", \"unit_id\", \"updated_at\", \"visits\") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20) RETURNING \"id\"", "error_class"=>"ActiveRecord::StatementInvalid"

The error changed to this with no code changes - I was just getting an unknown attribute: branch_name error.

What could be causing this? My migration ran fine, when I look in my database i see branch_name, and if I use the Rails Console and manually go through the steps that my code is going through, one by one, it works fine. It only fails when I use Sidekiq. I am using Ruby 2.0.0 and Rails 4.0.0.

Adrian CB

My opinion is that the schema is cached. Have you tried restarting all of your workers?

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

ActionView::Template::Error (PG::UndefinedColumn: ERROR: column "weeknumber" does not exist

From Dev

PG::UndefinedColumn: ERROR: column comments.post_id does not exist

From Dev

PG::UndefinedColumn: ERROR: column photos.attachable_type does not exist

From Dev

queue classic returns PG::UndefinedColumn: ERROR: column "pid" does not exist

From Dev

PG::UndefinedColumn: ERROR: column sections.row_order does not exist

From Dev

Rake db:migrate error 'PG::UndefinedColumn: ERROR: column "slug" does not exist'

From Dev

PG::UndefinedColumn: ERROR: column "city_id" of relation "events" does not exist

From Dev

Receiving the error PG::UndefinedColumn: ERROR: column mymodels.distance does not exist when using Geocoder's near method

From Dev

Receiving the error PG::UndefinedColumn: ERROR: column mymodels.distance does not exist when using Geocoder's near method

From Dev

Pg:Error column does not exist

From Dev

When I do having PG::UndefinedColumn: ERROR

From Dev

Rails: PG::UndefinedTable: ERROR: relation "..." does not exist

From Dev

PG::UndefinedTable: ERROR: relation does not exist

From Dev

PG::UndefinedTable: ERROR: relation "musicians" does not exist

From Dev

PG::UndefinedTable: ERROR: relation 'caves' does not exist

From Dev

PG::UndefinedObject: ERROR: type "hstore" does not exist but it does

From Dev

rake aborted! PG::UndefinedTable: ERROR: relation "pages" does not exist

From Dev

Getting PG::UndefinedFunction: ERROR: operator does not exist: integer ~~* integer

From Dev

PG::UndefinedTable: ERROR: table "table-name" does not exist

From Dev

pg_restore error: role XXX does not exist

From Dev

rake aborted! PG::UndefinedTable: ERROR: relation "pages" does not exist

From Dev

PG::UndefinedFunction: ERROR: operator does not exist: character varying @> point

From Dev

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "guestbooks" does not exist

From Dev

pg_restore ERROR: “Relation does not exist” and creating new database

From Dev

Heroku + Apartment PG::Error: ERROR: function pg_stat_statements_reset() does not exist

From Dev

In Rails, Ransack search gives the error `PG::UndefinedFunction: ERROR: operator does not exist` when trying to filter by ID

From Dev

ActionView::Template::Error (PG::UndefinedFunction: ERROR: operator does not exist: integer ~~ unknown

From Dev

i18n-active_record PG::Error: ERROR: relation "translations" does not exist (rails 4)

From Dev

i18n-active_record PG::Error: ERROR: relation "translations" does not exist (rails 4)

Related Related

  1. 1

    ActionView::Template::Error (PG::UndefinedColumn: ERROR: column "weeknumber" does not exist

  2. 2

    PG::UndefinedColumn: ERROR: column comments.post_id does not exist

  3. 3

    PG::UndefinedColumn: ERROR: column photos.attachable_type does not exist

  4. 4

    queue classic returns PG::UndefinedColumn: ERROR: column "pid" does not exist

  5. 5

    PG::UndefinedColumn: ERROR: column sections.row_order does not exist

  6. 6

    Rake db:migrate error 'PG::UndefinedColumn: ERROR: column "slug" does not exist'

  7. 7

    PG::UndefinedColumn: ERROR: column "city_id" of relation "events" does not exist

  8. 8

    Receiving the error PG::UndefinedColumn: ERROR: column mymodels.distance does not exist when using Geocoder's near method

  9. 9

    Receiving the error PG::UndefinedColumn: ERROR: column mymodels.distance does not exist when using Geocoder's near method

  10. 10

    Pg:Error column does not exist

  11. 11

    When I do having PG::UndefinedColumn: ERROR

  12. 12

    Rails: PG::UndefinedTable: ERROR: relation "..." does not exist

  13. 13

    PG::UndefinedTable: ERROR: relation does not exist

  14. 14

    PG::UndefinedTable: ERROR: relation "musicians" does not exist

  15. 15

    PG::UndefinedTable: ERROR: relation 'caves' does not exist

  16. 16

    PG::UndefinedObject: ERROR: type "hstore" does not exist but it does

  17. 17

    rake aborted! PG::UndefinedTable: ERROR: relation "pages" does not exist

  18. 18

    Getting PG::UndefinedFunction: ERROR: operator does not exist: integer ~~* integer

  19. 19

    PG::UndefinedTable: ERROR: table "table-name" does not exist

  20. 20

    pg_restore error: role XXX does not exist

  21. 21

    rake aborted! PG::UndefinedTable: ERROR: relation "pages" does not exist

  22. 22

    PG::UndefinedFunction: ERROR: operator does not exist: character varying @> point

  23. 23

    ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "guestbooks" does not exist

  24. 24

    pg_restore ERROR: “Relation does not exist” and creating new database

  25. 25

    Heroku + Apartment PG::Error: ERROR: function pg_stat_statements_reset() does not exist

  26. 26

    In Rails, Ransack search gives the error `PG::UndefinedFunction: ERROR: operator does not exist` when trying to filter by ID

  27. 27

    ActionView::Template::Error (PG::UndefinedFunction: ERROR: operator does not exist: integer ~~ unknown

  28. 28

    i18n-active_record PG::Error: ERROR: relation "translations" does not exist (rails 4)

  29. 29

    i18n-active_record PG::Error: ERROR: relation "translations" does not exist (rails 4)

HotTag

Archive