Search code examples
postgresqlrails-postgresql

What is the role of -s flag in creating user


I am trying to a create a user in postgres, I did the following.

sudo -u postgres createuser mystore

But I found out that I should use -s flag while creating the user, So my question is what is role of -s flag while creating user.

And I tried to remove the user by the following steps

sudo -u postgres psql 

drop user mystore 

Then tried to create the store with the -s flag, it says role "mystore" already exists.

How to handle this


Solution

  • createuser -s will give the new user superuser privileges. As with most command-line tools in Linux, you can get a description of each flag by running createuser --help.

    The problem in psql appears to be a missing semicolon after your drop command. psql supports multi-line statements, so hitting Enter will simply add a new line; it won't submit the command to the server until it sees a semicolon terminator.