Menu
Amazon Redshift
Database Developer Guide (API Version 2012-12-01)

SET SESSION AUTHORIZATION

Sets the user name for the current session.

You can use the SET SESSION AUTHORIZATION command, for example, to test database access by temporarily running a session or transaction as an unprivileged user.

Syntax

Copy
SET [ SESSION | LOCAL ] SESSION AUTHORIZATION { user_name | DEFAULT }

Parameters

SESSION

Specifies that the setting is valid for the current session. Default value.

LOCAL

Specifies that the setting is valid for the current transaction.

user_name

Name of the user to set. The user name may be written as an identifier or a string literal.

DEFAULT

Sets the session user name to the default value.

Examples

The following example sets the user name for the current session to dwuser:

Copy
SET SESSION AUTHORIZATION 'dwuser';

The following example sets the user name for the current transaction to dwuser:

Copy
SET LOCAL SESSION AUTHORIZATION 'dwuser';

This example sets the user name for the current session to the default user name:

Copy
SET SESSION AUTHORIZATION DEFAULT;