Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit eebfb9b

Browse files
committed
create/alter user extension
This one should work much better than the one I sent in previously. The functionality is the same, but the patch was missing one file resulting in the compilation failing. The docs also received a minor fix. Peter Eisentraut Sernanders väg 10:115
1 parent 3ab5b1f commit eebfb9b

File tree

6 files changed

+210
-107
lines changed

6 files changed

+210
-107
lines changed

doc/src/sgml/ref/alter_user.sgml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_user.sgml,v 1.8 1999/07/22 15:09:06 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_user.sgml,v 1.9 1999/11/30 03:57:22 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -23,7 +23,10 @@ Postgres documentation
2323
<date>1999-07-20</date>
2424
</refsynopsisdivinfo>
2525
<synopsis>
26-
ALTER USER <replaceable class="PARAMETER">username</replaceable> [ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ]
26+
ALTER USER <replaceable class="PARAMETER">username</replaceable>
27+
[ WITH
28+
[ SYSID <replaceable class="PARAMETER">uid</replaceable> ]
29+
[ PASSWORD <replaceable class="PARAMETER">password</replaceable> ] ]
2730
[ CREATEDB | NOCREATEDB ] [ CREATEUSER | NOCREATEUSER ]
2831
[ IN GROUP <replaceable class="PARAMETER">groupname</replaceable> [, ...] ]
2932
[ VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>' ]
@@ -62,6 +65,22 @@ ALTER USER <replaceable class="PARAMETER">username</replaceable> [ WITH PASSWORD
6265
</listitem>
6366
</varlistentry>
6467

68+
<varlistentry>
69+
<term><replaceable class="parameter">uid</replaceable></term>
70+
<listitem>
71+
<para>
72+
The new <productname>PostgreSQL</productname> user id of the user.
73+
Since this number is used as a key into the
74+
<literal>pg_shadow</literal>/<literal>pg_user</literal> table
75+
throughout the system catalogs, it is not recommended that you change
76+
it unless the user in question does not own anything at all and/or
77+
you really know what you are doing. Note that it is not necessary that
78+
database and <acronym>UNIX</acronym> user ids match, but some people
79+
choose to keep the numbers the same.
80+
</para>
81+
</listitem>
82+
</varlistentry>
83+
6584
<varlistentry>
6685
<term><replaceable class="PARAMETER"> groupname </replaceable></term>
6786
<listitem>
@@ -130,9 +149,7 @@ ERROR: alterUser: user "username" does not exist
130149
<para>
131150
<command>ALTER USER</command> is used to change the attributes of a user's
132151
<productname>Postgres</productname> account.
133-
Please note that it is not possible
134-
to alter a user's "<literal>usesysid</literal>" via the alter user
135-
statement. Also, it is only possible for the
152+
Also, it is only possible for the
136153
<productname>Postgres</productname>
137154
user or any user with read and modify permissions on
138155
<literal>pg_shadow</literal> to alter user passwords.
@@ -161,9 +178,7 @@ ERROR: alterUser: user "username" does not exist
161178
to create or remove a user account.
162179
</para>
163180
<para>
164-
In the current release (v6.5), the IN GROUP clause is parsed
165-
but has no affect. When it is fully implemented, it is
166-
intended to modify the pg_group relation.
181+
The IN GROUP clause is not yet implemented.
167182
</para>
168183
</refsect2>
169184
</refsect1>

doc/src/sgml/ref/create_user.sgml

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_user.sgml,v 1.9 1999/10/07 16:40:36 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_user.sgml,v 1.10 1999/11/30 03:57:23 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -23,8 +23,10 @@ Postgres documentation
2323
<date>1999-07-20</date>
2424
</refsynopsisdivinfo>
2525
<synopsis>
26-
CREATE USER<replaceable class="PARAMETER"> username</replaceable>
27-
[ WITH PASSWORD <replaceable class="PARAMETER">password</replaceable> ]
26+
CREATE USER <replaceable class="PARAMETER">username</replaceable>
27+
[ WITH
28+
[ SYSID <replaceable class="PARAMETER">uid</replaceable> ]
29+
[ PASSWORD <replaceable class="PARAMETER">password</replaceable> ] ]
2830
[ CREATEDB | NOCREATEDB ] [ CREATEUSER | NOCREATEUSER ]
2931
[ IN GROUP <replaceable class="PARAMETER">groupname</replaceable> [, ...] ]
3032
[ VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>' ]
@@ -49,11 +51,28 @@ CREATE USER<replaceable class="PARAMETER"> username</replaceable>
4951
</listitem>
5052
</varlistentry>
5153

54+
<varlistentry>
55+
<term><replaceable class="parameter">uid</replaceable></term>
56+
<listitem>
57+
<para>
58+
The <literal>SYSID</literal> clause can be used to choose
59+
the <productname>PostgreSQL</productname> user id of the user
60+
that is being created. It is not at all necessary that those
61+
match the <acronym>UNIX</acronym> user ids, but some people
62+
choose to keep the numbers the same.
63+
</para>
64+
<para>
65+
If this is not specified, the highest assigned user id plus one
66+
will be used as default.
67+
</para>
68+
</listitem>
69+
</varlistentry>
70+
5271
<varlistentry>
5372
<term><replaceable class="parameter">password</replaceable></term>
5473
<listitem>
5574
<para>
56-
The WITH PASSWORD clause sets the user's password within
75+
The PASSWORD clause sets the user's password within
5776
the "<filename>pg_shadow</filename>" table. For this reason,
5877
<filename>"pg_shadow</filename>" is no
5978
longer accessible to the instance of
@@ -173,30 +192,9 @@ CREATE USER
173192
</title>
174193
<para>
175194
CREATE USER will add a new user to an instance of
176-
<productname>Postgres</productname>.
195+
<productname>PostgreSQL</productname>.
177196
</para>
178197

179-
<para>
180-
The new user will be given a <filename>usesysid</filename> of:
181-
182-
<programlisting>
183-
SELECT MAX(usesysid) + 1 FROM pg_shadow;
184-
</programlisting>
185-
186-
This means that
187-
<productname>Postgres</productname> users' <filename>usesysid</filename>s will not
188-
correspond to their operating
189-
system(OS) user ids. The exception to this rule is
190-
the <literal>postgres</literal> superuser, whose OS user id
191-
is used as the
192-
<filename>usesysid</filename> during the initdb process.
193-
If you still want the
194-
OS user id and the <filename>usesysid</filename> to match
195-
for any given user,
196-
use the <application>createuser</application> script provided with
197-
the <productname>Postgres</productname> distribution.
198-
</para>
199-
200198
<refsect2 id="R2-SQL-CREATEUSER-3">
201199
<refsect2info>
202200
<date>1998-09-21</date>
@@ -216,19 +214,17 @@ SELECT MAX(usesysid) + 1 FROM pg_shadow;
216214
Refer to the <filename>pg_shadow</filename> table for further information.
217215
</para>
218216
<programlisting>
219-
Table = pg_shadow
220-
+--------------------------+--------------------------+-------+
221-
| Field | Type | Length|
222-
+--------------------------+--------------------------+-------+
223-
| usename | name | 32 |
224-
| usesysid | int4 | 4 |
225-
| usecreatedb | bool | 1 |
226-
| usetrace | bool | 1 |
227-
| usesuper | bool | 1 |
228-
| usecatupd | bool | 1 |
229-
| passwd | text | var |
230-
| valuntil | abstime | 4 |
231-
+--------------------------+--------------------------+-------+
217+
Table "pg_shadow"
218+
Attribute | Type | Extra
219+
-------------+---------+-------
220+
usename | name |
221+
usesysid | int4 |
222+
usecreatedb | bool |
223+
usetrace | bool |
224+
usesuper | bool |
225+
usecatupd | bool |
226+
passwd | text |
227+
valuntil | abstime |
232228
</programlisting>
233229
</refsect2>
234230
</refsect1>

0 commit comments

Comments
 (0)