Upgrade fails: jsonb not found

I’ve upgraded discourse using launcher rebuild app, and the upgrade is failing:

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #  <Process::Status: pid 1655 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --verbose --without test --without development --retry 3 --jobs 4'", "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]}
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

Looking back through the errors, this one features several times:

Caused by:
PG::UndefinedObject: ERROR:  type "jsonb" does not exist
LINE 1: SELECT 'jsonb'::regtype::oid

I’ve upgraded docker to the latest and postegresql to v10 but the error has persisted?

(hosted in Ubuntu 14 Trusty)

1 Like

That happens when you are running an old version of PostgreSQL.

Can you share the first lines of your app.yml?


Trusty end of life was over two years ago. You rely need to upgrade the OS too.

1 Like



At least, I guess this is the first two lines that matter.

Upgrading from Trusty: well, ok, but that’s not the problem here though?

1 Like

Yes, Trusty is likely not the problem here.

I think that if you remove 9.3 from the template name then it’ll upgrade postgres for you. You want to make sure that you have a backup before you start, though.

1 Like

ok thanks. I’ll apply myself to trying to figure out how to backup the database. (name? username? password? I don’t have any record of these things)

If your system is running just do a backup from the web interface.

Edit: that’s backup, not update.

Removing that line results in a failed upgrade because “No connection to db, unable to retrieve site settings”…

Hmm. Look in the templates directory. I guess I got the name wrong.

Did you remove the line, or the version from the line? It sounds like you removed it completely.

The template you were using specified the postgres version, if you drop the version then Discourse will be able to manage required versions as the requirements increment.


ok that sorted it - thanks

careless of me :frowning: