-1

I have 3 tasks:

  1. Create a database owner with 'sa' rights.
  2. Create three database users.
  3. Transfer the rights from the user from task 1 to one of the users from task 2.

I know how to solve first and second tasks:

CREATE USER admin WITH LOGIN PASSWORD 'password' SUPERUSER;
CREATE USER user1 WITH LOGIN PASSWORD 'user1';
CREATE USER user2 WITH LOGIN PASSWORD 'user2';
CREATE USER user3 WITH LOGIN PASSWORD 'user3';

How can I solve third task?

peeebeee
  • 2,541
  • 6
  • 21
  • 26
TupleCats
  • 351
  • 3
  • 15
  • 1
    What do you mean with `sa` rights? There is no such role (or user) in Postgres. But in genera, if you want to manage a certain set of privileges for multiple users, create a role, grant the privileges to that role, then grant the role to the users. –  Dec 17 '18 at 13:41
  • I meant `sa` like `superuser`. I didn't know that `sa` exists only in MsSQL. – TupleCats Dec 17 '18 at 13:47

1 Answers1

0

You need to use the grant function:

GRANT admin TO user1;
JGH
  • 15,928
  • 4
  • 31
  • 48