# PG::UndefinedTable: ERROR: relation "translation\_overrides" does not exist

**URL:** https://meta.discourse.org/t/pg-undefinedtable-error-relation-translation-overrides-does-not-exist/42599
**Category:** Development
**Created:** [April 15, 2016, 9:46am UTC](https://meta.discourse.org/t/pg-undefinedtable-error-relation-translation-overrides-does-not-exist/42599 "2016-04-15T09:46:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jamesarobbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesarobbo/32/121843_2.png) [@jamesarobbo](https://meta.discourse.org/u/jamesarobbo)
#### Post date: [April 15, 2016, 9:46am UTC](https://meta.discourse.org/t/pg-undefinedtable-error-relation-translation-overrides-does-not-exist/42599/1 "2016-04-15T09:46:09Z")

</div>

I have cloned master and in trying to run migrations i get this error:

ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation “translation\_overrides” does not exist

I see that a topic was created for this last November and seemingly fixed so i’m wondering what coudl be the cause?

```
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "translation_overrides" does not exist
remote: LINE 5: WHERE a.attrelid = '"translation_overrides"':...
remote: ^
remote: : SELECT a.attname, format_type(a.atttypid, a.atttypmod),
remote: pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
remote: FROM pg_attribute a LEFT JOIN pg_attrdef d
remote: ON a.attrelid = d.adrelid AND a.attnum = d.adnum
remote: WHERE a.attrelid = '"translation_overrides"'::regclass
remote: AND a.attnum > 0 AND NOT a.attisdropped
remote: ORDER BY a.attnum

PG::UndefinedTable: ERROR: relation "translation_overrides" does not exist
remote: LINE 5: WHERE a.attrelid = '"translation_overrides"':...

```

thanks

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [April 15, 2016, 9:52am UTC](https://meta.discourse.org/t/pg-undefinedtable-error-relation-translation-overrides-does-not-exist/42599/2 "2016-04-15T09:52:38Z")

</div>

Is that a dev setup? If so, then run “`rake db:drop db:create db:migrate`” again.

---

<div class="post-metadata">

### Author: ![jamesarobbo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jamesarobbo/32/121843_2.png) [@jamesarobbo](https://meta.discourse.org/u/jamesarobbo)
#### Post date: [April 15, 2016, 9:57am UTC](https://meta.discourse.org/t/pg-undefinedtable-error-relation-translation-overrides-does-not-exist/42599/3 "2016-04-15T09:57:03Z")

</div>

production but getting it to run on heroku (i realise that heroku is not the ‘supported’, ‘recommended’ setup 🙂 ). despite that, do you have any ideas? thanks a lot

---

<div class="post-metadata">

### Author: ![marcosbc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marcosbc/32/222119_2.png) [@marcosbc](https://meta.discourse.org/u/marcosbc)
#### Post date: [May 27, 2021, 11:01am UTC](https://meta.discourse.org/t/pg-undefinedtable-error-relation-translation-overrides-does-not-exist/42599/4 "2021-05-27T11:01:33Z")

</div>

Hi all, this seems to be the same issue as [Migration error on fresh startup running in k8s cluster](https://meta.discourse.org/t/migration-error-on-fresh-startup-running-in-k8s-cluster/184751), and we were able to reproduce it in a vanilla Discourse launcher setup using the official [standalone.yml template](https://raw.githubusercontent.com/discourse/discourse_docker/master/samples/standalone.yml) when deploying it:

```plaintext
$ ./launcher rebuild app
...
I, [2021-05-27T10:53:27.612150 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake plugin:pull_compatible_all'
I, [2021-05-27T10:53:30.072954 #1] INFO -- : docker_manager is already at latest compatible version

I, [2021-05-27T10:53:30.073194 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'

2021-05-27 10:53:32.977 UTC [4354] discourse@discourse ERROR: relation "translation_overrides" does not exist at character 454
2021-05-27 10:53:32.977 UTC [4354] discourse@discourse STATEMENT: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
	       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
	       c.collname, col_description(a.attrelid, a.attnum) AS comment
	  FROM pg_attribute a
	  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
	  LEFT JOIN pg_type t ON a.atttypid = t.oid
	  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
	 WHERE a.attrelid = '"translation_overrides"'::regclass
	   AND a.attnum > 0 AND NOT a.attisdropped
	 ORDER BY a.attnum

Warning: no type cast defined for type "name" with oid 19. Please cast this type explicitly to TEXT to be safe for future changes.
> Seeding theme and color schemes
I, [2021-05-27T10:53:49.976589 #1] INFO -- : == 20000225050318 AddSchemaMigrationDetails: migrating ========================
...

```

---

<div class="post-metadata">

### Author: ![Eric\_Keller](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eric_keller/32/517693_2.png) [@Eric\_Keller](https://meta.discourse.org/u/Eric_Keller)
#### Post date: [May 20, 2026, 10:17am UTC](https://meta.discourse.org/t/pg-undefinedtable-error-relation-translation-overrides-does-not-exist/42599/5 "2026-05-20T10:17:55Z")

</div>

This also happen on a simple discourse\_docker official installation, using some automated restore test over pipeline every morning of the week. This similar error suddenly appeared in the failed pipeline.

```plaintext
I, [2026-05-20T07:59:01.413128 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle  
  exec rake db:migrate'                                                                                                                                                                       
  2026-05-20 07:59:09.214 UTC [1576] discourse@discourse ERROR: relation "translation_overrides" does not exist at character 523                                                             
  2026-05-20 07:59:09.214 UTC [1576] discourse@discourse STATEMENT: SELECT a.attname, format_type(a.atttypid, a.atttypmod),                                                                  
             pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,                                                                                                          
             c.collname, col_description(a.attrelid, a.attnum) AS comment,                                                                                                                    
             attidentity AS identity,                                                                                                                                                         
             attgenerated as attgenerated                                                                                                                                                     
        FROM pg_attribute a                                                                                                                                                                   
        LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum                                                                                                               
        LEFT JOIN pg_type t ON a.atttypid = t.oid                                                                                                                                             
        LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation                                                                                               
       WHERE a.attrelid = '"translation_overrides"'::regclass                                                                                                                                 
         AND a.attnum > 0 AND NOT a.attisdropped                                                                                                                                              
       ORDER BY a.attnum                                                                                                                                                                      
                                                                                                                                                                                              
  2026-05-20 07:59:13.167 UTC [1627] discourse@discourse ERROR: schema "discourse_functions" already exists                                                                                  
  2026-05-20 07:59:13.167 UTC [1627] discourse@discourse STATEMENT: CREATE SCHEMA discourse_functions;                                                                                       
  psql:/var/www/discourse/db/structure.sql:16: ERROR: schema "discourse_functions" already exists                                                                                            
  rake aborted!

```

The root cause was a version mismatch between restored backup and container code.

The latest Discourse code has a model referencing translation\_overrides, but the production database (from the backup) is on an older version where this table either doesn’t exist yet or has a different name.

what worked for me is to rebuild first (which creates the schema from scratch), then restore the backup. The restore process uses Discourse’s built-in restore which properly drops and recreates the database.
