Skip to content

Database user is not allowed to re-create the database #819

@mkllnk

Description

@mkllnk

Description

A change in the way we use the postgresql role means that the CREATEDB privilege is not passed on to the user creation. We can't drop and create the database. That is useful when importing another database, for example when switching production servers.

Expected Behavior

DISABLE_DATABASE_ENVIRONMENT_CHECK=1 I_AM_SURE=1 bundle exec rails db:drop db:create
# database created

Actual Behaviour

DISABLE_DATABASE_ENVIRONMENT_CHECK=1 I_AM_SURE=1 bundle exec rails db:drop db:create
# error on db:create

Steps to Reproduce

  1. Fresh server, for example with vagrant destroy; vagrant up.
  2. Provision and deploy.
  3. Try to re-create the database.

Animated Gif/Screenshot

Severity

Your Environment

  • Version used:
  • Browser name and version:
  • Operating System and version (desktop or mobile):

Possible Fix

We added some workarounds in ebd62cd which could now be removed if we upgrade the postgresql role.

Workaround

Give the user permission manually:

# sudo -u postgres psql
alter user ofn_user createdb;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    All the things 💤

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions