Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1aac2c8

Browse files
committed
User and database-specific session defaults for run-time configuration
variables. New commands ALTER DATABASE ... SET and ALTER USER ... SET.
1 parent851f766 commit1aac2c8

File tree

29 files changed

+812
-48
lines changed

29 files changed

+812
-48
lines changed

‎doc/src/sgml/catalogs.sgml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--
22
Documentation of the system catalogs, directed toward PostgreSQL developers
3-
$Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.30 2002/02/18 23:10:59 petere Exp $
3+
$Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.31 2002/03/01 22:45:03 petere Exp $
44
-->
55

66
<chapter id="catalogs">
@@ -889,6 +889,13 @@
889889
or an absolute path, depending how it was entered.
890890
</entry>
891891
</row>
892+
893+
<row>
894+
<entry>datconfig</entry>
895+
<entry><type>text[]</type></entry>
896+
<entry></entry>
897+
<entry>Session defaults for run-time configuration variables</entry>
898+
</row>
892899
</tbody>
893900
</tgroup>
894901
</table>
@@ -1980,6 +1987,13 @@
19801987
<entry></entry>
19811988
<entry>Account expiry time (only used for password authentication)</entry>
19821989
</row>
1990+
1991+
<row>
1992+
<entry>useconfig</entry>
1993+
<entry><type>text[]</type></entry>
1994+
<entry></entry>
1995+
<entry>Session defaults for run-time configuration variables</entry>
1996+
</row>
19831997
</tbody>
19841998
</tgroup>
19851999
</table>

‎doc/src/sgml/ref/allfiles.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.32 2002/01/15 05:05:49 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.33 2002/03/01 22:45:07 petere Exp $
33
PostgreSQL documentation
44
Complete list of usable sgml source files in this directory.
55
-->
@@ -37,6 +37,7 @@ Complete list of usable sgml source files in this directory.
3737

3838
<!-- SQL commands -->
3939
<!entity abort system "abort.sgml">
40+
<!entity alterDatabase system "alter_database.sgml">
4041
<!entity alterGroup system "alter_group.sgml">
4142
<!entity alterTable system "alter_table.sgml">
4243
<!entity alterUser system "alter_user.sgml">

‎doc/src/sgml/ref/alter_database.sgml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
<!--
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_database.sgml,v 1.1 2002/03/01 22:45:07 petere Exp $
3+
PostgreSQL documentation
4+
-->
5+
6+
<refentry id="SQL-ALTERDATABASE">
7+
<refmeta>
8+
<refentrytitle id="sql-alterdatabase-title">ALTER DATABASE</refentrytitle>
9+
<refmiscinfo>SQL - Language Statements</refmiscinfo>
10+
</refmeta>
11+
12+
<refnamediv>
13+
<refname>ALTER DATABASE</refname>
14+
<refpurpose>change a database</refpurpose>
15+
</refnamediv>
16+
17+
<refsynopsisdiv>
18+
<synopsis>
19+
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> SET <replaceable>variable</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
20+
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET <replaceable>variable</replaceable>
21+
</synopsis>
22+
</refsynopsisdiv>
23+
24+
<refsect1>
25+
<title>Description</title>
26+
27+
<para>
28+
<command>ALTER DATABASE</command> is used to change the session
29+
default of a run-time configuration variable for a
30+
<productname>PostgreSQL</productname> database. Whenever a new
31+
session is subsequently started, <literal>SET
32+
<replaceable>variable</replaceable> TO
33+
<replaceable>value</replaceable></literal> is effectively executed
34+
before the start of the session.
35+
</para>
36+
37+
<para>
38+
Only a database owner can change the session defaults for a
39+
database. Superusers can change the session defaults of any
40+
database.
41+
</para>
42+
43+
<refsect2>
44+
<title>Parameters</title>
45+
46+
<para>
47+
<variablelist>
48+
<varlistentry>
49+
<term><replaceable class="PARAMETER">name</replaceable></term>
50+
<listitem>
51+
<para>
52+
The name of the database whose session defaults are to be altered.
53+
</para>
54+
</listitem>
55+
</varlistentry>
56+
57+
<varlistentry>
58+
<term><replaceable>variable</replaceable></term>
59+
<term><replaceable>value</replaceable></term>
60+
<listitem>
61+
<para>
62+
Set the session default for this database of the specified
63+
configuration variable to the given value. If
64+
<replaceable>value</replaceable> is <literal>DEFAULT</literal>
65+
or, equivalently, <literal>RESET</literal> is used, the
66+
database-specific variable setting is removed and the default
67+
setting will be inherited in new sessions. Use <literal>RESET
68+
ALL</literal> to clear all settings.
69+
</para>
70+
71+
<para>
72+
See <xref linkend="sql-set" endterm="sql-set-title"> and the
73+
<citetitle>Administrator's Guide</citetitle> for more
74+
information about allowed variable names and values.
75+
</para>
76+
</listitem>
77+
</varlistentry>
78+
</variablelist>
79+
</para>
80+
</refsect2>
81+
</refsect1>
82+
83+
<refsect1>
84+
<title>Diagnostics</title>
85+
86+
<para>
87+
<variablelist>
88+
<varlistentry>
89+
<term><computeroutput>ALTER DATABASE</computeroutput></term>
90+
<listitem>
91+
<para>
92+
Message returned if the alteration was successful.
93+
</para>
94+
</listitem>
95+
</varlistentry>
96+
97+
<varlistentry>
98+
<term><computeroutput>ERROR: database "dbname" does not exist</computeroutput></term>
99+
<listitem>
100+
<para>
101+
Error message returned if the specified database is not known
102+
to the system.
103+
</para>
104+
</listitem>
105+
</varlistentry>
106+
</variablelist>
107+
</para>
108+
</refsect1>
109+
110+
<refsect1>
111+
<title>Notes</title>
112+
113+
<para>
114+
Using <xref linkend="sql-alteruser" endterm="sql-alteruser-title">,
115+
it is also possible to tie a session default to a specific user
116+
rather than a database.
117+
</para>
118+
</refsect1>
119+
120+
<refsect1>
121+
<title>Examples</title>
122+
123+
<para>
124+
To disable index scans by default in the database
125+
<literal>test</literal>:
126+
127+
<programlisting>
128+
ALTER DATABASE test SET enable_indexscan TO off;
129+
</programlisting>
130+
</para>
131+
</refsect1>
132+
133+
<refsect1>
134+
<title>Compatibility</title>
135+
136+
<para>
137+
The <command>ALTER DATABASE</command> statement is a
138+
<productname>PostgreSQL</productname> extension.
139+
</para>
140+
</refsect1>
141+
142+
<refsect1>
143+
<title>See Also</title>
144+
145+
<simplelist type="inline">
146+
<member><xref linkend="sql-alteruser" endterm="sql-alteruser-title"></member>
147+
<member><xref linkend="sql-createdatabase" endterm="sql-createdatabase-title"></member>
148+
<member><xref linkend="sql-dropdatabase" endterm="sql-dropdatabase-title"></member>
149+
<member><xref linkend="sql-set" endterm="sql-set-title"></member>
150+
</simplelist>
151+
</refsect1>
152+
</refentry>
153+
154+
<!-- Keep this comment at the end of the file
155+
Local variables:
156+
mode: sgml
157+
sgml-omittag:nil
158+
sgml-shorttag:t
159+
sgml-minimize-attributes:nil
160+
sgml-always-quote-attributes:t
161+
sgml-indent-step:1
162+
sgml-indent-data:t
163+
sgml-parent-document:nil
164+
sgml-default-dtd-file:"../reference.ced"
165+
sgml-exposed-tags:nil
166+
sgml-local-catalogs:"/usr/lib/sgml/catalog"
167+
sgml-local-ecat-files:nil
168+
End:
169+
-->

‎doc/src/sgml/ref/alter_user.sgml

Lines changed: 49 additions & 4 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.19 2002/02/27 21:14:53 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_user.sgml,v 1.20 2002/03/01 22:45:07 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -24,6 +24,9 @@ where <replaceable class="PARAMETER">option</replaceable> can be:
2424
| CREATEDB | NOCREATEDB
2525
| CREATEUSER | NOCREATEUSER
2626
| VALID UNTIL '<replaceable class="PARAMETER">abstime</replaceable>'
27+
28+
ALTER USER <replaceable class="PARAMETER">username</replaceable> SET <replaceable>variable</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
29+
ALTER USER <replaceable class="PARAMETER">username</replaceable> RESET <replaceable>variable</replaceable>
2730
</synopsis>
2831
</refsynopsisdiv>
2932

@@ -37,9 +40,22 @@ where <replaceable class="PARAMETER">option</replaceable> can be:
3740
</para>
3841

3942
<para>
40-
Only a database superuser can change privileges and password
41-
expiration with this command. Ordinary users can only change their
42-
own password.
43+
The first variant of this command in the synopsis changes certain
44+
global user privileges and authentication settings. (See below for
45+
details.) Only a database superuser can change privileges and
46+
password expiration with this command. Ordinary users can only
47+
change their own password.
48+
</para>
49+
50+
<para>
51+
The second and the third variant change a user's session default of
52+
a specified configuration variable. Whenever the user subsequently
53+
starts a new session, <literal>SET
54+
<replaceable>variable</replaceable> TO
55+
<replaceable>value</replaceable></literal> is effectively executed
56+
before the start of the session. Ordinary users can change their
57+
own session defaults. Superusers can change anyone's session
58+
defaults.
4359
</para>
4460

4561
<refsect2>
@@ -113,6 +129,28 @@ where <replaceable class="PARAMETER">option</replaceable> can be:
113129
</para>
114130
</listitem>
115131
</varlistentry>
132+
133+
<varlistentry>
134+
<term><replaceable>variable</replaceable></term>
135+
<term><replaceable>value</replaceable></term>
136+
<listitem>
137+
<para>
138+
Set this user's session default of the specified configuration
139+
variable to the given value. If
140+
<replaceable>value</replaceable> is <literal>DEFAULT</literal>
141+
or, equivalently, <literal>RESET</literal> is used, the
142+
user-specific variable setting is removed and the user will
143+
inherit the default setting in new sessions. Use
144+
<literal>RESET ALL</literal> to clear all settings.
145+
</para>
146+
147+
<para>
148+
See <xref linkend="sql-set" endterm="sql-set-title"> and the
149+
<citetitle>Administrator's Guide</citetitle> for more
150+
information about allowed variable names and values.
151+
</para>
152+
</listitem>
153+
</varlistentry>
116154
</variablelist>
117155
</para>
118156
</refsect2>
@@ -159,6 +197,12 @@ where <replaceable class="PARAMETER">option</replaceable> can be:
159197
Use <xref linkend="SQL-ALTERGROUP" endterm="SQL-ALTERGROUP-title">
160198
to do that.
161199
</para>
200+
201+
<para>
202+
Using <xref linkend="sql-alterdatabase"
203+
endterm="sql-alterdatabase-title">, it is also possible to tie a
204+
session default to a specific database rather than a user.
205+
</para>
162206
</refsect1>
163207

164208
<refsect1>
@@ -214,6 +258,7 @@ ALTER USER miriam CREATEUSER CREATEDB;
214258
<simplelist type="inline">
215259
<member><xref linkend="sql-createuser" endterm="sql-createuser-title"></member>
216260
<member><xref linkend="sql-dropuser" endterm="sql-dropuser-title"></member>
261+
<member><xref linkend="sql-set" endterm="sql-set-title"></member>
217262
</simplelist>
218263
</refsect1>
219264
</refentry>

‎doc/src/sgml/reference.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- reference.sgml
2-
$Header: /cvsroot/pgsql/doc/src/sgml/reference.sgml,v 1.20 2002/01/15 05:05:49 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/reference.sgml,v 1.21 2002/03/01 22:45:04 petere Exp $
33

44
PostgreSQL Reference Manual
55
-->
@@ -46,6 +46,7 @@ PostgreSQL Reference Manual
4646
</partintro>
4747

4848
&abort;
49+
&alterDatabase;
4950
&alterGroup;
5051
&alterTable;
5152
&alterUser;

‎doc/src/sgml/release.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.118 2002/02/24 20:20:19 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.119 2002/03/01 22:45:04 petere Exp $
33
-->
44

55
<appendix id="release">
@@ -28,6 +28,8 @@ Access privileges on functions
2828
Access privileges on procedural languages
2929
CREATE DATABASE has OWNER option so superuser can create DB for someone else
3030
Kerberos 5 support now works with Heimdal
31+
Database and user-specific session defaults of run-time configurations variables
32+
(ALTER DATABASE ... SET and ALTER USER ... SET)
3133
]]></literallayout>
3234

3335
</sect1>

‎doc/src/sgml/runtime.sgml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.103 2002/01/20 22:19:56 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.104 2002/03/01 22:45:05 petere Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -537,12 +537,17 @@ env PGOPTIONS='-c geqo=off' psql
537537
</para>
538538

539539
<para>
540-
Finally, someoptions can be changed in individual SQL sessions
541-
with the<command>SET</command> command, for example
540+
Someoptions can be changed in individual SQL sessions with the
541+
<command>SET</command> command, for example
542542
<screen>
543543
=&gt; <userinput>SET ENABLE_SEQSCAN TO OFF;</userinput>
544544
</screen>
545545
See the SQL command language reference for details on the syntax.
546+
Furthermore, it is possible to assign a set of option settings to
547+
a user or a database. Whenever a session is started, the default
548+
settings for the user and database involved are loaded. The
549+
commands <literal>ALTER DATABASE</literal> and <literal>ALTER
550+
USER</literal>, respectively, are used to set this up.
546551
</para>
547552

548553
<sect2 id="runtime-config-optimizer">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp