Oracle Alter session like in postgres

If you are looking for looking for

alter session set curent_schema=ABCD; 

kind of statement in postgres we have 


Example :

dvdrental=# create user test password 'test';
CREATE ROLE
                       

If you want to inherit permissions of another role you can do :


dvdrental=# alter role test  CREATEROLE CREATEDB;
ALTER ROLE

dvdrental=# SELECT SESSION_USER, CURRENT_USER;
 session_user | current_user
--------------+--------------
 postgres     | postgres
(1 row)

If you want to change user to another user without reconnecting (like sudo in Linux) :


dvdrental=# SET SESSION AUTHORIZATION 'test';
SET
dvdrental=> SELECT SESSION_USER, CURRENT_USER;
 session_user | current_user
--------------+--------------
 test         | test
(1 row)

dvdrental=>

Comments

Popular posts from this blog

switching between users in postgres

Connecting to PostgresSQL database