1999-07-22 17:09:15 +02:00
<!--
2010-09-20 22:08:53 +02:00
doc/src/sgml/ref/alter_user.sgml
2001-12-08 04:24:40 +01:00
PostgreSQL documentation
1999-07-22 17:09:15 +02:00
-->
2017-10-20 03:16:39 +02:00
<refentry id="sql-alteruser">
2014-02-24 03:25:35 +01:00
<indexterm zone="sql-alteruser">
<primary>ALTER USER</primary>
</indexterm>
1999-07-06 19:16:42 +02:00
<refmeta>
2010-04-03 09:23:02 +02:00
<refentrytitle>ALTER USER</refentrytitle>
2008-11-14 11:22:48 +01:00
<manvolnum>7</manvolnum>
1999-07-06 19:16:42 +02:00
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
2002-02-27 22:14:54 +01:00
1999-07-06 19:16:42 +02:00
<refnamediv>
2002-02-27 22:14:54 +01:00
<refname>ALTER USER</refname>
2005-07-27 01:24:02 +02:00
<refpurpose>change a database role</refpurpose>
1998-12-29 03:24:47 +01:00
</refnamediv>
2002-02-27 22:14:54 +01:00
1999-07-06 19:16:42 +02:00
<refsynopsisdiv>
2002-02-27 22:14:54 +01:00
<synopsis>
2017-10-09 04:00:57 +02:00
ALTER USER <replaceable class="parameter">role_specification</replaceable> [ WITH ] <replaceable class="parameter">option</replaceable> [ ... ]
2001-07-11 00:09:29 +02:00
2017-10-09 04:00:57 +02:00
<phrase>where <replaceable class="parameter">option</replaceable> can be:</phrase>
2010-11-23 21:27:50 +01:00
2005-07-27 01:24:02 +02:00
SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB
| CREATEROLE | NOCREATEROLE
| INHERIT | NOINHERIT
| LOGIN | NOLOGIN
2010-12-29 11:05:03 +01:00
| REPLICATION | NOREPLICATION
2016-01-28 15:29:04 +01:00
| BYPASSRLS | NOBYPASSRLS
2017-10-09 04:00:57 +02:00
| CONNECTION LIMIT <replaceable class="parameter">connlimit</replaceable>
| [ ENCRYPTED ] PASSWORD '<replaceable class="parameter">password</replaceable>'
| VALID UNTIL '<replaceable class="parameter">timestamp</replaceable>'
2002-03-01 23:45:19 +01:00
2017-10-09 04:00:57 +02:00
ALTER USER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
2003-06-27 16:45:32 +02:00
2017-10-09 04:00:57 +02:00
ALTER USER { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
ALTER USER { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> FROM CURRENT
ALTER USER { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] RESET <replaceable>configuration_parameter</replaceable>
ALTER USER { <replaceable class="parameter">role_specification</replaceable> | ALL } [ IN DATABASE <replaceable class="parameter">database_name</replaceable> ] RESET ALL
Allow CURRENT/SESSION_USER to be used in certain commands
Commands such as ALTER USER, ALTER GROUP, ALTER ROLE, GRANT, and the
various ALTER OBJECT / OWNER TO, as well as ad-hoc clauses related to
roles such as the AUTHORIZATION clause of CREATE SCHEMA, the FOR clause
of CREATE USER MAPPING, and the FOR ROLE clause of ALTER DEFAULT
PRIVILEGES can now take the keywords CURRENT_USER and SESSION_USER as
user specifiers in place of an explicit user name.
This commit also fixes some quite ugly handling of special standards-
mandated syntax in CREATE USER MAPPING, which in particular would fail
to work in presence of a role named "current_user".
The special role specifiers PUBLIC and NONE also have more consistent
handling now.
Also take the opportunity to add location tracking to user specifiers.
Authors: Kyotaro Horiguchi. Heavily reworked by Álvaro Herrera.
Reviewed by: Rushabh Lathia, Adam Brightwell, Marti Raudsepp.
2015-03-09 19:41:54 +01:00
2017-10-09 04:00:57 +02:00
<phrase>where <replaceable class="parameter">role_specification</replaceable> can be:</phrase>
Allow CURRENT/SESSION_USER to be used in certain commands
Commands such as ALTER USER, ALTER GROUP, ALTER ROLE, GRANT, and the
various ALTER OBJECT / OWNER TO, as well as ad-hoc clauses related to
roles such as the AUTHORIZATION clause of CREATE SCHEMA, the FOR clause
of CREATE USER MAPPING, and the FOR ROLE clause of ALTER DEFAULT
PRIVILEGES can now take the keywords CURRENT_USER and SESSION_USER as
user specifiers in place of an explicit user name.
This commit also fixes some quite ugly handling of special standards-
mandated syntax in CREATE USER MAPPING, which in particular would fail
to work in presence of a role named "current_user".
The special role specifiers PUBLIC and NONE also have more consistent
handling now.
Also take the opportunity to add location tracking to user specifiers.
Authors: Kyotaro Horiguchi. Heavily reworked by Álvaro Herrera.
Reviewed by: Rushabh Lathia, Adam Brightwell, Marti Raudsepp.
2015-03-09 19:41:54 +01:00
2017-10-09 04:00:57 +02:00
<replaceable class="parameter">role_name</replaceable>
Allow CURRENT/SESSION_USER to be used in certain commands
Commands such as ALTER USER, ALTER GROUP, ALTER ROLE, GRANT, and the
various ALTER OBJECT / OWNER TO, as well as ad-hoc clauses related to
roles such as the AUTHORIZATION clause of CREATE SCHEMA, the FOR clause
of CREATE USER MAPPING, and the FOR ROLE clause of ALTER DEFAULT
PRIVILEGES can now take the keywords CURRENT_USER and SESSION_USER as
user specifiers in place of an explicit user name.
This commit also fixes some quite ugly handling of special standards-
mandated syntax in CREATE USER MAPPING, which in particular would fail
to work in presence of a role named "current_user".
The special role specifiers PUBLIC and NONE also have more consistent
handling now.
Also take the opportunity to add location tracking to user specifiers.
Authors: Kyotaro Horiguchi. Heavily reworked by Álvaro Herrera.
Reviewed by: Rushabh Lathia, Adam Brightwell, Marti Raudsepp.
2015-03-09 19:41:54 +01:00
| CURRENT_USER
| SESSION_USER
2002-02-27 22:14:54 +01:00
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
1999-07-06 19:16:42 +02:00
2002-02-27 22:14:54 +01:00
<para>
2005-07-27 01:24:02 +02:00
<command>ALTER USER</command> is now an alias for
2017-11-23 15:39:47 +01:00
<xref linkend="sql-alterrole"/>.
1999-07-06 19:16:42 +02:00
</para>
</refsect1>
2002-02-27 22:14:54 +01:00
<refsect1>
<title>Compatibility</title>
2010-11-23 21:27:50 +01:00
2002-02-27 22:14:54 +01:00
<para>
The <command>ALTER USER</command> statement is a
<productname>PostgreSQL</productname> extension. The SQL standard
leaves the definition of users to the implementation.
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
2017-11-23 15:39:47 +01:00
<member><xref linkend="sql-alterrole"/></member>
2002-02-27 22:14:54 +01:00
</simplelist>
1999-07-06 19:16:42 +02:00
</refsect1>
</refentry>