Search code examples
ruby-on-railspostgresqlqueue-classic

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


When I do

bundle exec rake qc:work

to run queue_calssic, I get this error

rake aborted!
PG::UndefinedColumn: ERROR:  column "pid" does not exist
LINE 1: ..., locked_by = NULL WHERE locked_by NOT IN (SELECT pid FROM p...
                                                             ^
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/conn_adapter.rb:18:in `exec'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/conn_adapter.rb:18:in `block in execute'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/conn_adapter.rb:14:in `synchronize'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/conn_adapter.rb:14:in `execute'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic.rb:104:in `unlock_jobs_of_dead_workers'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/worker.rb:42:in `start'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/tasks.rb:27:in `block (2 levels) in <top (required)>'
/home/andreas/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/home/andreas/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => qc:work

When I do psql --version i get psql (PostgreSQL) 9.3.5

Any ideas on what might be wrong?


Solution

  • Do you have the entire query? The most important part is missing, the function or view where "pid" doesn't exist. Wild guess: You're not using version 9.3 but an older one, where procpid is used. pg_stat_activity changed this columnname in version 9.2

    Use this query to get the server version:

    SELECT version();
    

    An upgrade to a newer version can be done by a dump-restore or pg_upgrade.