# Error "relation 'users' does not exist" when installing discourse

**URL:** https://meta.discourse.org/t/error-relation-users-does-not-exist-when-installing-discourse/99246
**Category:** Self-hosting
**Created:** [October 11, 2018, 4:33am UTC](https://meta.discourse.org/t/error-relation-users-does-not-exist-when-installing-discourse/99246 "2018-10-11T04:33:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![UnivacTwo](https://avatars.discourse-cdn.com/v4/letter/u/df705f/32.png) [@UnivacTwo](https://meta.discourse.org/u/UnivacTwo)
#### Post date: [October 11, 2018, 4:33am UTC](https://meta.discourse.org/t/error-relation-users-does-not-exist-when-installing-discourse/99246/1 "2018-10-11T04:33:06Z")

</div>

Hello,

I am trying to install a new discourse on a clean server but I get this error:

```
I, [2018-10-11T04:28:17.965799 #14] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
2018-10-11 04:28:24.160 UTC [365] discourse@discourse ERROR: relation "users" does not exist at character 566
2018-10-11 04:28:24.160 UTC [365] 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 = '"users"'::regclass
                         AND a.attnum > 0 AND NOT a.attisdropped
                       ORDER BY a.attnum

2018-10-11 04:28:35.564 UTC [374] discourse@discourse LOG: duration: 100.559 ms statement: ALTER TABLE "users" ADD "staged" boolean DEFAULT FALSE NOT NULL

```

This is definitely a bug, I tried on multiple servers with different OS versions.

Probably it is something with the current version of discourse

it alway end with this message error:

```
I, [2018-10-11T07:15:34.658740 #14] INFO -- : Terminating async processes
I, [2018-10-11T07:15:34.658882 #14] INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/10/bin/postmaster -D /etc/postgresql/10/main pid: 84
I, [2018-10-11T07:15:34.659052 #14] INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 200
200:signal-handler (1539242134) Received SIGTERM scheduling shutdown...
2018-10-11 07:15:34.659 UTC [84] LOG: received fast shutdown request
2018-10-11 07:15:34.680 UTC [84] LOG: aborting any active transactions
2018-10-11 07:15:34.685 UTC [84] LOG: worker process: logical replication launcher (PID 93) exited with exit code 1
2018-10-11 07:15:34.688 UTC [88] LOG: shutting down
200:M 11 Oct 07:15:34.758 # User requested shutdown...
200:M 11 Oct 07:15:34.758 * Saving the final RDB snapshot before exiting.
200:M 11 Oct 07:15:34.787 * DB saved on disk
200:M 11 Oct 07:15:34.787 # Redis is now ready to exit, bye bye...
2018-10-11 07:15:34.873 UTC [84] LOG: database system is shut down

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake assets:precompile' failed with return #<Process::Status: pid 1429 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'"]}
6e330632df0aef58e54069e5041a77d3624c8f870d1a7939cb738df4b2c6adba
**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one

```

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 11, 2018, 9:31am UTC](https://meta.discourse.org/t/error-relation-users-does-not-exist-when-installing-discourse/99246/2 "2018-10-11T09:31:53Z")

</div>

Possible, @tgxworld?

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [October 11, 2018, 3:46pm UTC](https://meta.discourse.org/t/error-relation-users-does-not-exist-when-installing-discourse/99246/6 "2018-10-11T15:46:55Z")

</div>

To confirm as of 4:47PM, the error:

```
I, [2018-10-11T15:37:48.991417 #14] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
2018-10-11 15:37:59.592 UTC [374] discourse@discourse ERROR: relation "users" does not exist at character 566
2018-10-11 15:37:59.592 UTC [374] 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 = '"users"'::regclass
	                 AND a.attnum > 0 AND NOT a.attisdropped
	               ORDER BY a.attnum

```

Does appear during an install, but the build succeeds.

 ![03%20AM](https://global.discourse-cdn.com/meta/original/3X/d/3/d3c875f67777cbb81169988835f85d66a0f90115.jpeg)

That’s the full recommended install, with domain name specified (IP address based install not supported), SMTP details provided, and Let’s Encrypt enabled.

- Did you add any files to your install between git pull and ./discourse-setup?
- Did you add any plugins before completing the build at least once?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [January 17, 2019, 9:24am UTC](https://meta.discourse.org/t/error-relation-users-does-not-exist-when-installing-discourse/99246/31 "2019-01-17T09:24:20Z")

</div>

> [@tgxworld](#):
>
> The error is actually harmless but I’ll see if I can hunt down what is trying to connect to the users table even before the table has been created.

This has been fixed in

[https://github.com/discourse/discourse/commit/6edf285c893fdca4584e73a7274febcd586c665b](https://github.com/discourse/discourse/commit/6edf285c893fdca4584e73a7274febcd586c665b)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 17, 2019, 9:30am UTC](https://meta.discourse.org/t/error-relation-users-does-not-exist-when-installing-discourse/99246/32 "2019-01-17T09:30:54Z")

</div>


