# Upgrade fails on old version of Postgres database

**URL:** <https://meta.discourse.org/t/upgrade-fails-on-old-version-of-postgres-database/103287>\
**Category:** Self-hosting\
**Tags:** unsupported-install\
**Created:** [December 2, 2018, 10:46am UTC](https://meta.discourse.org/t/upgrade-fails-on-old-version-of-postgres-database/103287 "2018-12-02T10:46:30Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![gtanczyk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gtanczyk/32/44608_2.png) [@gtanczyk](https://meta.discourse.org/u/gtanczyk)\
**Post date:** [December 2, 2018, 10:46am UTC](https://meta.discourse.org/t/upgrade-fails-on-old-version-of-postgres-database/103287/1 "2018-12-02T10:46:30Z")

</div>

I’m upgrading from v2.0.0.beta5 +110 to 2.2.0.beta5  
Postgres version: 9.4

Error message:

```
Caused by:
ActiveRecord::StatementInvalid: PG::DatatypeMismatch: ERROR: column "info" is of type jsonb but expression is of type json
LINE 13: json_build_object('email', email, 'first_name', first_name...
       ^
HINT: You will need to rewrite or cast the expression.
: INSERT INTO user_associated_accounts (
  provider_name,
  provider_uid,
  user_id,
  info,
  last_used,
  created_at,
  updated_at
) SELECT
  'facebook',
  facebook_user_id,
  user_id,
  json_build_object('email', email, 'first_name', first_name, 'last_name', last_name, 'name', name),
  updated_at,
  created_at,
  updated_at
FROM facebook_user_infos
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/pg.rb:92:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/pg.rb:92:in `async_exec'

```

Looks like it’s related to this new commit by @david: [discourse/db/migrate/20181128140547\_migrate\_facebook\_user\_info.rb at 208005f9c9662773b436c4ffa14272ac0888bb04 · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/208005f9c9662773b436c4ffa14272ac0888bb04/db/migrate/20181128140547_migrate_facebook_user_info.rb)

---

_[View the full topic](https://meta.discourse.org/t/upgrade-fails-on-old-version-of-postgres-database/103287)._
