postgresql/doc/src/sgml/ref/alter_user.sgml

250 lines
5.9 KiB
Plaintext
Raw Normal View History

<refentry id="SQL-ALTERUSER">
<refmeta>
<refentrytitle>
1998-05-13 07:34:00 +02:00
ALTER USER
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
1998-05-13 07:34:00 +02:00
ALTER USER
</refname>
<refpurpose>
1998-05-13 07:34:00 +02:00
Modifies user account information
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-09-08</date>
</refsynopsisdivinfo>
1998-05-13 07:34:00 +02:00
<synopsis>
1998-09-16 16:43:12 +02:00
ALTER USER <replaceable class="PARAMETER">username</replaceable>
[ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ]
[ CREATEDB | NOCREATEDB ]
[ CREATEUSER | NOCREATEUSER ]
[ IN GROUP <replaceable class="PARAMETER">groupname</replaceable> [, ...] ]
[ VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>' ]
1998-05-13 07:34:00 +02:00
</synopsis>
<refsect2 id="R2-SQL-ALTERUSER-1">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
1998-05-13 07:34:00 +02:00
Inputs
</title>
<para>
1998-09-16 16:43:12 +02:00
Refer to <command>CREATE USER</command> for a detailed description of each
1998-05-13 07:34:00 +02:00
clause.
</para>
<variablelist>
<varlistentry>
<term>
<replaceable class="PARAMETER"> username </replaceable>
</term>
<listitem>
<para>
1998-05-13 07:34:00 +02:00
The Postgres account name of the user whose details are to be altered.
</para>
</listitem>
</varlistentry>
1998-09-16 16:43:12 +02:00
<varlistentry>
<term>
<replaceable class="PARAMETER"> password </replaceable>
</term>
<listitem>
<para>
1998-05-13 07:34:00 +02:00
The new password to be used for this account.
</para>
</listitem>
</varlistentry>
1998-09-16 16:43:12 +02:00
<varlistentry>
<term>
<replaceable class="PARAMETER"> groupname </replaceable>
</term>
<listitem>
<para>
1998-05-13 07:34:00 +02:00
The name of an access group into which this account is to be put.
</para>
</listitem>
</varlistentry>
1998-09-16 16:43:12 +02:00
<varlistentry>
<term>
<replaceable class="PARAMETER"> abstime </replaceable>
</term>
<listitem>
<para>
1998-09-16 16:43:12 +02:00
The date (and, optionally, the time)
at which this user's access is to be terminated.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
1998-05-13 07:34:00 +02:00
<refsect2 id="R2-SQL-ALTERUSER-2">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
1998-05-13 07:34:00 +02:00
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term>
<returnvalue>ALTER USER</returnvalue>
</term>
<listitem>
<para>
Message returned if the alteration was successful.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<returnvalue>ERROR: alterUser: user "username" does not exist</returnvalue>
</term>
<listitem>
<para>
Error message returned if the user specified doesn't
exist.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-ALTERUSER-1">
<refsect1info>
<date>1998-09-08</date>
</refsect1info>
<title>
1998-05-13 07:34:00 +02:00
Description
</title>
<para>
1998-09-16 16:43:12 +02:00
<command>ALTER USER</command> is used to change the attributes of a user's
<productname>Postgres</productname> account.
Please note that it is not possible
1998-05-13 07:34:00 +02:00
to alter a user's "usesysid" via the alter user
1998-09-16 16:43:12 +02:00
statement. Also, it is only possible for the
<productname>Postgres</productname>
1998-05-13 07:34:00 +02:00
user or any user with read and modify permissions on
"pg_shadow" to alter user passwords.
</para>
1998-05-13 07:34:00 +02:00
<para>
If any of the clauses of the alter user statement are
omitted, the corresponding value in the "pg_shadow" table
is left unchanged.
</para>
<refsect2 id="R2-SQL-ALTERUSER-3">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
1998-05-13 07:34:00 +02:00
Notes
</title>
<para>
1998-09-16 16:43:12 +02:00
<command>ALTER USER</command> statement
is a <productname>Postgres</productname>
language extension.
1998-05-13 07:34:00 +02:00
</para>
<para>
1998-09-16 16:43:12 +02:00
Refer to <command>CREATE/DROP USER</command>
to create or remove a user
1998-05-13 07:34:00 +02:00
account.
</para>
<para>
In the current release (v6.5), the IN GROUP clause is parsed
1998-09-16 16:43:12 +02:00
but has no affect. When it is fully implemented, it is
1998-05-13 07:34:00 +02:00
intended to modify the pg_group relation.
</para>
</refsect2>
1998-05-13 07:34:00 +02:00
</refsect1>
<refsect1 id="R1-SQL-ALTERUSER-2">
<title>
1998-05-13 07:34:00 +02:00
Usage
</title>
<para>
1998-05-13 07:34:00 +02:00
Change a user password
</para>
<programlisting>
1998-09-16 16:43:12 +02:00
ALTER USER davide WITH PASSWORD hu8jmn3;
</programlisting>
1998-05-13 07:34:00 +02:00
<para>
Change a user's valid until date
</para>
<programlisting>
1998-09-16 16:43:12 +02:00
ALTER USER manuel VALID UNTIL 'Jan 31 2030';
</programlisting>
1998-05-13 07:34:00 +02:00
<para>
Change a user's valid until date, specifying that his
authorisation should expire at midday on 4th May 1998 using
the time zone which is one hour ahead of UTC
</para>
<programlisting>
1998-09-16 16:43:12 +02:00
ALTER USER chris VALID UNTIL 'May 4 12:00:00 1998 +1';
</programlisting>
1998-05-13 07:34:00 +02:00
<para>
Give a user the ability to create other users and new databases.
</para>
<programlisting>
1998-09-16 16:43:12 +02:00
ALTER USER miriam CREATEUSER CREATEDB;
1998-05-13 07:34:00 +02:00
</programlisting>
<para>
Place a user in two groups
</para>
<programlisting>
1998-09-16 16:43:12 +02:00
ALTER USER miriam IN GROUP sales, payroll;
1998-05-13 07:34:00 +02:00
</programlisting>
</refsect1>
1998-05-13 07:34:00 +02:00
<refsect1 id="R1-SQL-ALTERUSER-3">
<title>
1998-05-13 07:34:00 +02:00
Compatibility
</title>
<para>
</para>
1998-05-13 07:34:00 +02:00
<refsect2 id="R2-SQL-ALTERUSER-4">
<refsect2info>
<date>1998-09-08</date>
</refsect2info>
<title>
1998-05-13 07:34:00 +02:00
SQL92
</title>
<para>
1998-09-16 16:43:12 +02:00
There is no <command>ALTER USER</command> statement in
<acronym>SQL92</acronym>.
The standard leaves
1998-05-13 07:34:00 +02:00
the definition of users to the implementation.
</para>
</refsect2>
1998-05-13 07:34:00 +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
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:
-->