Read more

PostgreSQL: Upgrading your user to a superuser

Dominik Schöler
February 06, 2018Software engineer at makandra GmbH

Your default postgres user is named like your linux user. That default user has limited access privileges, which can cause issues such as:

  • DatabaseCleaner needs to disable foreign key constraints before it can wipe the database.
  • Importing a remote dump with geordi Show archive.org snapshot
  • Asking Postgres to show the storage path of a database
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Doing these things without a superuser will show a Postgres error or (in Ruby) raise PG::InsufficientPrivilege.

To do so, the application's PostgreSQL user must be a superuser. Grant superuser rights like this:

$ sudo -u postgres psql
# ALTER USER <your username> WITH SUPERUSER;
Posted by Dominik Schöler to makandra dev (2018-02-06 15:51)