How to grant Connect & Create Privilege on current Database in PostgreSQL? After looking at the docs, I know that you can grant Connect &amp; Create Privileges by using the following commands:

GRANT CREATE ON DATABASE &lt;db_name&gt; TO user;
GRANT CONNECT ON DATABASE &lt;db_name&gt; TO user;


How do I grant these privileges on the current database without specifying it's name?

I'm trying to write a script which will be used to grant all rights whenever a new database is created by my application, and hence I don't know what the name will be while writing the script.
You could use a DO block with dynamic SQL:

do 
$$ 
begin
  execute format('grant create, connect on database %I to %I', current_database(), 'some_user');
end;
$$;