Here is promised documentation.
Be warned that both my writing skills and my english are far from good :)
--
Regards
Petr Jelinek (PJMODOS)
Index: doc/src/sgml/catalogs.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v
retrieving revision 2.109
diff -c -r2.109 catalogs.sgml
*** doc/src/sgml/catalogs.sgml 26 Jul 2005 16:38:25 -0000 2.109
--- doc/src/sgml/catalogs.sgml 30 Jul 2005 18:48:10 -0000
***************
*** 1019,1024 ****
--- 1019,1035 ----
</row>
<row>
+ <entry><structfield>rolconnlimit</structfield></entry>
+ <entry><type>int4</type></entry>
+ <entry></entry>
+ <entry>
+ For roles that can login this sets maximum amount of concurrent
+ connections this role can make. Default value (-1) means
+ unlimited connections, zero (0) means role can't login.
+ </entry>
+ </row>
+
+ <row>
<entry><structfield>rolpassword</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
***************
*** 1922,1927 ****
--- 1933,1949 ----
</row>
<row>
+ <entry><structfield>datconnlimit</structfield></entry>
+ <entry><type>int4</type></entry>
+ <entry></entry>
+ <entry>
+ Sets maximum amount of concurrent connections that can be made
+ to this database. Default value (-1) means unlimited connections,
+ zero (0) means that database isn't accepting connections.
+ </entry>
+ </row>
+
+ <row>
<entry><structfield>datlastsysoid</structfield></entry>
<entry><type>oid</type></entry>
<entry></entry>
***************
*** 4812,4817 ****
--- 4834,4850 ----
</row>
<row>
+ <entry><structfield>rolconnlimit</structfield></entry>
+ <entry><type>int4</type></entry>
+ <entry></entry>
+ <entry>
+ For roles that can login this sets maximum amount of concurrent
+ connections this role can make. Default value (-1) means
+ unlimited connections, zero (0) means role can't login.
+ </entry>
+ </row>
+
+ <row>
<entry><structfield>rolpassword</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
***************
*** 5094,5099 ****
--- 5127,5143 ----
</row>
<row>
+ <entry><structfield>useconnlimit</structfield></entry>
+ <entry><type>int4</type></entry>
+ <entry></entry>
+ <entry>
+ This sets maximum amount of concurrent connections this user can make.
+ Default value (-1) means unlimited connections,
+ zero (0) means user can't login.
+ </entry>
+ </row>
+
+ <row>
<entry><structfield>passwd</structfield></entry>
<entry><type>text</type></entry>
<entry></entry>
Index: doc/src/sgml/ref/alter_database.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/alter_database.sgml,v
retrieving revision 1.15
diff -c -r1.15 alter_database.sgml
*** doc/src/sgml/ref/alter_database.sgml 5 Jan 2005 14:22:39 -0000
1.15
--- doc/src/sgml/ref/alter_database.sgml 30 Jul 2005 18:48:11 -0000
***************
*** 23,28 ****
--- 23,34 ----
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> SET
<replaceable>parameter</replaceable> { TO | = } {
<replaceable>value</replaceable> | DEFAULT }
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET
<replaceable>parameter</replaceable>
+ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ]
<replaceable class="PARAMETER">option</replaceable> [ ... ] ]
+
+ where <replaceable class="PARAMETER">option</replaceable> can be:
+
+ CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
+
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RENAME TO
<replaceable>newname</replaceable>
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> OWNER TO
<replaceable>new_owner</replaceable>
***************
*** 51,57 ****
</para>
<para>
! The third form changes the name of the database. Only the database
owner or a superuser can rename a database; non-superuser owners must
also have the
<literal>CREATEDB</literal> privilege. The current database cannot
--- 57,68 ----
</para>
<para>
! The third form changes certain per-database settings. (See below for
! details.) Only database owner or superuser can change these settings.
! </para>
!
! <para>
! The fourth form changes the name of the database. Only the database
owner or a superuser can rename a database; non-superuser owners must
also have the
<literal>CREATEDB</literal> privilege. The current database cannot
***************
*** 60,66 ****
</para>
<para>
! The fourth form changes the owner of the database. Only a superuser
can change the database's owner.
</para>
</refsect1>
--- 71,77 ----
</para>
<para>
! The fifth form changes the owner of the database. Only a superuser
can change the database's owner.
</para>
</refsect1>
***************
*** 100,105 ****
--- 111,128 ----
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><replaceable class="parameter">connlimit</replaceable></term>
+ <listitem>
+ <para>
+ Number specifying how many concurrent connections can be made
+ to this database. Default (-1) means unlimited
+ (limited by max_connections config variable only),
+ zero (0) means that no connections are allowed.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><replaceable>newname</replaceable></term>
<listitem>
Index: doc/src/sgml/ref/alter_role.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/alter_role.sgml,v
retrieving revision 1.1
diff -c -r1.1 alter_role.sgml
*** doc/src/sgml/ref/alter_role.sgml 26 Jul 2005 23:24:02 -0000 1.1
--- doc/src/sgml/ref/alter_role.sgml 30 Jul 2005 18:48:12 -0000
***************
*** 30,35 ****
--- 30,36 ----
| CREATEUSER | NOCREATEUSER
| INHERIT | NOINHERIT
| LOGIN | NOLOGIN
+ | CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable
class="PARAMETER">password</replaceable>'
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
***************
*** 118,123 ****
--- 119,135 ----
<term><literal>NOINHERIT</literal></term>
<term><literal>LOGIN</literal></term>
<term><literal>NOLOGIN</literal></term>
+ <term><literal>CONNECTION LIMIT</literal> <replaceable
class="parameter">connlimit</replaceable></term>
+ <listitem>
+ <para>
+ If role can login, this specifies many concurrent connections
+ role can make. Default (-1) means unlimited
+ (limited by max_connections config variable only),
+ zero (0) means that role can't connect to server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><literal>PASSWORD</> <replaceable
class="parameter">password</replaceable></term>
<term><literal>ENCRYPTED</></term>
<term><literal>UNENCRYPTED</></term>
***************
*** 225,230 ****
--- 237,250 ----
</para>
<para>
+ Set role's maximum connections:
+
+ <programlisting>
+ ALTER ROLE peter WITH CONNECTION LIMIT 20;
+ </programlisting>
+ </para>
+
+ <para>
Give a role a non-default setting of the
<xref linkend="guc-maintenance-work-mem"> parameter:
Index: doc/src/sgml/ref/alter_user.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/alter_user.sgml,v
retrieving revision 1.38
diff -c -r1.38 alter_user.sgml
*** doc/src/sgml/ref/alter_user.sgml 26 Jul 2005 23:24:02 -0000 1.38
--- doc/src/sgml/ref/alter_user.sgml 30 Jul 2005 18:48:12 -0000
***************
*** 30,35 ****
--- 30,36 ----
| CREATEUSER | NOCREATEUSER
| INHERIT | NOINHERIT
| LOGIN | NOLOGIN
+ | CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable
class="PARAMETER">password</replaceable>'
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
Index: doc/src/sgml/ref/create_database.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/create_database.sgml,v
retrieving revision 1.43
diff -c -r1.43 create_database.sgml
*** doc/src/sgml/ref/create_database.sgml 29 Oct 2004 03:17:22 -0000
1.43
--- doc/src/sgml/ref/create_database.sgml 30 Jul 2005 18:48:12 -0000
***************
*** 24,30 ****
[ [ WITH ] [ OWNER [=] <replaceable
class="parameter">dbowner</replaceable> ]
[ TEMPLATE [=] <replaceable
class="parameter">template</replaceable> ]
[ ENCODING [=] <replaceable
class="parameter">encoding</replaceable> ]
! [ TABLESPACE [=] <replaceable
class="parameter">tablespace</replaceable> ] ]
</synopsis>
</refsynopsisdiv>
--- 24,31 ----
[ [ WITH ] [ OWNER [=] <replaceable
class="parameter">dbowner</replaceable> ]
[ TEMPLATE [=] <replaceable
class="parameter">template</replaceable> ]
[ ENCODING [=] <replaceable
class="parameter">encoding</replaceable> ]
! [ TABLESPACE [=] <replaceable
class="parameter">tablespace</replaceable> ]
! [ CONNECTION LIMIT [=] <replaceable
class="parameter">connlimit</replaceable> ] ]
</synopsis>
</refsynopsisdiv>
***************
*** 123,128 ****
--- 124,140 ----
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><replaceable class="parameter">connlimit</replaceable></term>
+ <listitem>
+ <para>
+ Number specifying how many concurrent connections can be made
+ to this database. Default (-1) means unlimited
+ (limited by max_connections config variable only),
+ zero (0) means that no connections are allowed.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>
Index: doc/src/sgml/ref/create_role.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/create_role.sgml,v
retrieving revision 1.1
diff -c -r1.1 create_role.sgml
*** doc/src/sgml/ref/create_role.sgml 26 Jul 2005 23:24:02 -0000 1.1
--- doc/src/sgml/ref/create_role.sgml 30 Jul 2005 18:48:13 -0000
***************
*** 30,35 ****
--- 30,36 ----
| CREATEUSER | NOCREATEUSER
| INHERIT | NOINHERIT
| LOGIN | NOLOGIN
+ | CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable
class="PARAMETER">password</replaceable>'
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
| IN ROLE <replaceable class="PARAMETER">rolename</replaceable> [, ...]
***************
*** 173,178 ****
--- 174,191 ----
</varlistentry>
<varlistentry>
+ <term><literal>CONNECTION LIMIT</literal> <replaceable
class="parameter">connlimit</replaceable></term>
+ <listitem>
+ <para>
+ If role can login, this specifies many concurrent connections
+ role can make. Default (-1) means unlimited
+ (limited by max_connections config variable only),
+ zero (0) means that role can't connect to server.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><literal>PASSWORD</> <replaceable
class="parameter">password</replaceable></term>
<listitem>
<para>
Index: doc/src/sgml/ref/create_user.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/create_user.sgml,v
retrieving revision 1.37
diff -c -r1.37 create_user.sgml
*** doc/src/sgml/ref/create_user.sgml 26 Jul 2005 23:24:02 -0000 1.37
--- doc/src/sgml/ref/create_user.sgml 30 Jul 2005 18:48:13 -0000
***************
*** 30,35 ****
--- 30,36 ----
| CREATEUSER | NOCREATEUSER
| INHERIT | NOINHERIT
| LOGIN | NOLOGIN
+ | CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable
class="PARAMETER">password</replaceable>'
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
| IN ROLE <replaceable class="PARAMETER">rolename</replaceable> [, ...]
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend