1999-07-22 17:09:15 +02:00
|
|
|
<!--
|
2002-02-27 22:14:54 +01:00
|
|
|
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_user.sgml,v 1.19 2002/02/27 21:14:53 petere Exp $
|
2001-12-08 04:24:40 +01:00
|
|
|
PostgreSQL documentation
|
1999-07-22 17:09:15 +02:00
|
|
|
-->
|
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<refentry id="SQL-ALTERUSER">
|
|
|
|
<refmeta>
|
2002-02-27 22:14:54 +01:00
|
|
|
<refentrytitle id="sql-alteruser-title">ALTER USER</refentrytitle>
|
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>
|
|
|
|
<refpurpose>change a database user account</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>
|
2001-07-11 00:09:29 +02:00
|
|
|
ALTER USER <replaceable class="PARAMETER">username</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
|
|
|
|
|
|
|
|
where <replaceable class="PARAMETER">option</replaceable> can be:
|
|
|
|
|
2002-02-27 22:14:54 +01:00
|
|
|
[ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
|
|
|
|
| CREATEDB | NOCREATEDB
|
|
|
|
| CREATEUSER | NOCREATEUSER
|
|
|
|
| VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>'
|
|
|
|
</synopsis>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2002-02-27 22:14:54 +01:00
|
|
|
<para>
|
|
|
|
<command>ALTER USER</command> is used to change the attributes of a
|
|
|
|
<productname>PostgreSQL</productname> user account. Attributes not
|
|
|
|
mentioned in the command retain their previous settings.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Only a database superuser can change privileges and password
|
|
|
|
expiration with this command. Ordinary users can only change their
|
|
|
|
own password.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<refsect2>
|
|
|
|
<title>Parameters</title>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2000-01-14 23:11:38 +01:00
|
|
|
<term><replaceable class="PARAMETER">username</replaceable></term>
|
1999-07-06 19:16:42 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2002-02-27 22:14:54 +01:00
|
|
|
The name of the user whose attributes are to be altered.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2001-09-21 22:31:49 +02:00
|
|
|
<term><replaceable class="PARAMETER">password</replaceable></term>
|
1999-07-06 19:16:42 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The new password to be used for this account.
|
2001-09-21 22:31:49 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2002-02-27 22:14:54 +01:00
|
|
|
<term><literal>ENCRYPTED</literal></term>
|
|
|
|
<term><literal>UNENCRYPTED</literal></term>
|
2001-09-21 22:31:49 +02:00
|
|
|
<listitem>
|
2002-02-27 22:14:54 +01:00
|
|
|
<para>
|
|
|
|
These key words control whether the password is stored
|
|
|
|
encrypted in <literal>pg_shadow</>. (See
|
2001-09-21 22:31:49 +02:00
|
|
|
<xref linkend="SQL-CREATEUSER" endterm="SQL-CREATEUSER-title">
|
|
|
|
for more information about this choice.)
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
1999-11-30 04:57:29 +01:00
|
|
|
<varlistentry>
|
2002-02-27 22:14:54 +01:00
|
|
|
<term><literal>CREATEDB</literal></term>
|
|
|
|
<term><literal>NOCREATEDB</literal></term>
|
1999-11-30 04:57:29 +01:00
|
|
|
<listitem>
|
2002-02-27 22:14:54 +01:00
|
|
|
<para>
|
|
|
|
These clauses define a user's ability to create databases. If
|
|
|
|
<literal>CREATEDB</literal> is specified, the user being
|
|
|
|
defined will be allowed to create his own databases. Using
|
|
|
|
<literal>NOCREATEDB</literal> will deny a user the ability to
|
|
|
|
create databases.
|
1999-11-30 04:57:29 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<varlistentry>
|
2002-02-27 22:14:54 +01:00
|
|
|
<term><literal>CREATEUSER</literal></term>
|
|
|
|
<term><literal>NOCREATEUSER</literal></term>
|
1999-07-06 19:16:42 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2000-01-14 23:11:38 +01:00
|
|
|
These clauses determine whether a user will be permitted to
|
|
|
|
create new users himself. This option will also make the user
|
2002-02-27 22:14:54 +01:00
|
|
|
a superuser who can override all access restrictions.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2000-01-14 23:11:38 +01:00
|
|
|
<term><replaceable class="PARAMETER">abstime</replaceable></term>
|
1999-07-06 19:16:42 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The date (and, optionally, the time)
|
2000-01-14 23:11:38 +01:00
|
|
|
at which this user's password is to expire.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect2>
|
2002-02-27 22:14:54 +01:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Diagnostics</title>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
|
|
|
<para>
|
2002-02-27 22:14:54 +01:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><computeroutput>ALTER USER</computeroutput></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Message returned if the alteration was successful.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><computeroutput>ERROR: ALTER USER: user "username" does not exist</computeroutput></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Error message returned if the specified user is not known to
|
|
|
|
the database.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
2001-07-11 00:09:29 +02:00
|
|
|
</para>
|
2002-02-27 22:14:54 +01:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Notes</title>
|
|
|
|
|
2001-07-11 00:09:29 +02:00
|
|
|
<para>
|
2002-02-27 22:14:54 +01:00
|
|
|
Use <xref linkend="SQL-CREATEUSER" endterm="SQL-CREATEUSER-title">
|
|
|
|
to add new users, and <xref linkend="SQL-DROPUSER"
|
|
|
|
endterm="SQL-DROPUSER-title"> to remoe a user.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
2002-02-27 22:14:54 +01:00
|
|
|
|
2001-07-11 00:09:29 +02:00
|
|
|
<para>
|
|
|
|
<command>ALTER USER</command> cannot change a user's group memberships.
|
|
|
|
Use <xref linkend="SQL-ALTERGROUP" endterm="SQL-ALTERGROUP-title">
|
|
|
|
to do that.
|
|
|
|
</para>
|
1999-07-06 19:16:42 +02:00
|
|
|
</refsect1>
|
|
|
|
|
2002-02-27 22:14:54 +01:00
|
|
|
<refsect1>
|
|
|
|
<title>Examples</title>
|
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<para>
|
|
|
|
Change a user password:
|
|
|
|
|
2000-01-14 23:11:38 +01:00
|
|
|
<programlisting>
|
|
|
|
ALTER USER davide WITH PASSWORD 'hu8jmn3';
|
|
|
|
</programlisting>
|
2002-02-27 22:14:54 +01:00
|
|
|
</para>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2002-02-27 22:14:54 +01:00
|
|
|
<para>
|
2000-07-22 04:39:10 +02:00
|
|
|
Change a user's valid until date:
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2000-01-14 23:11:38 +01:00
|
|
|
<programlisting>
|
1998-09-16 16:43:12 +02:00
|
|
|
ALTER USER manuel VALID UNTIL 'Jan 31 2030';
|
2000-01-14 23:11:38 +01:00
|
|
|
</programlisting>
|
2002-02-27 22:14:54 +01:00
|
|
|
</para>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2002-02-27 22:14:54 +01:00
|
|
|
<para>
|
1999-07-06 19:16:42 +02:00
|
|
|
Change a user's valid until date, specifying that his
|
2000-07-22 06:30:27 +02:00
|
|
|
authorization should expire at midday on 4th May 1998 using
|
2000-07-22 04:39:10 +02:00
|
|
|
the time zone which is one hour ahead of UTC:
|
2000-01-14 23:11:38 +01:00
|
|
|
<programlisting>
|
1998-09-16 16:43:12 +02:00
|
|
|
ALTER USER chris VALID UNTIL 'May 4 12:00:00 1998 +1';
|
2000-01-14 23:11:38 +01:00
|
|
|
</programlisting>
|
2002-02-27 22:14:54 +01:00
|
|
|
</para>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2002-02-27 22:14:54 +01:00
|
|
|
<para>
|
2000-07-22 04:39:10 +02:00
|
|
|
Give a user the ability to create other users and new databases:
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2000-01-14 23:11:38 +01:00
|
|
|
<programlisting>
|
1998-09-16 16:43:12 +02:00
|
|
|
ALTER USER miriam CREATEUSER CREATEDB;
|
2000-01-14 23:11:38 +01:00
|
|
|
</programlisting>
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2002-02-27 22:14:54 +01:00
|
|
|
<refsect1>
|
|
|
|
<title>Compatibility</title>
|
1998-05-13 07:34:00 +02: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">
|
|
|
|
<member><xref linkend="sql-createuser" endterm="sql-createuser-title"></member>
|
|
|
|
<member><xref linkend="sql-dropuser" endterm="sql-dropuser-title"></member>
|
|
|
|
</simplelist>
|
1999-07-06 19:16:42 +02:00
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
1998-05-13 07:34:00 +02:00
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
1999-06-14 09:37:05 +02:00
|
|
|
sgml-omittag:nil
|
1998-05-13 07:34:00 +02:00
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"../reference.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:"/usr/lib/sgml/catalog"
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
-->
|