Skip to content

Commit 52a8d4f

Browse files
committed
Implement enum type for guc parameters, and convert a couple of existing
variables to it. More need to be converted, but I wanted to get this in before it conflicts with too much... Other than just centralising the text-to-int conversion for parameters, this allows the pg_settings view to contain a list of available options and allows an error hint to show what values are allowed.
1 parent 23c356c commit 52a8d4f

File tree

11 files changed

+440
-237
lines changed

11 files changed

+440
-237
lines changed

doc/src/sgml/catalogs.sgml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.162 2008/03/06 18:49:32 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.163 2008/03/10 12:55:13 mha Exp $ -->
22
<!--
33
Documentation of the system catalogs, directed toward PostgreSQL developers
44
-->
@@ -6260,8 +6260,8 @@
62606260
<row>
62616261
<entry><structfield>vartype</structfield></entry>
62626262
<entry><type>text</type></entry>
6263-
<entry>Parameter type (<literal>bool</>, <literal>integer</>,
6264-
<literal>real</>, or <literal>string</>)
6263+
<entry>Parameter type (<literal>bool</>, <literal>enum</>,
6264+
<literal>integer</>, <literal>real</>, or <literal>string</>)
62656265
</entry>
62666266
</row>
62676267
<row>
@@ -6281,6 +6281,12 @@
62816281
<entry>Maximum allowed value of the parameter (NULL for non-numeric
62826282
values)</entry>
62836283
</row>
6284+
<row>
6285+
<entry><structfield>enumvals</structfield></entry>
6286+
<entry><type>text</type></entry>
6287+
<entry>Allowed values in enum parameters (NULL for non-enum
6288+
values)</entry>
6289+
</row>
62846290
</tbody>
62856291
</tgroup>
62866292
</table>

doc/src/sgml/config.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.169 2008/03/10 03:22:29 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.170 2008/03/10 12:55:13 mha Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -162,7 +162,8 @@ SET ENABLE_SEQSCAN TO OFF;
162162
displaying and updating session run-time parameters. It is equivalent
163163
to <command>SHOW</> and <command>SET</>, but can be more convenient
164164
to use because it can be joined with other tables, or selected from using
165-
any desired selection condition.
165+
any desired selection condition. It also contains more information about
166+
what values are allowed for the parameters.
166167
</para>
167168
</sect1>
168169

src/backend/catalog/system_views.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 1996-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.48 2008/01/01 19:45:48 momjian Exp $
6+
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.49 2008/03/10 12:55:13 mha Exp $
77
*/
88

99
CREATE VIEW pg_roles AS
@@ -173,7 +173,7 @@ CREATE VIEW pg_settings AS
173173
SELECT *
174174
FROM pg_show_all_settings() AS A
175175
(name text, setting text, unit text, category text, short_desc text, extra_desc text,
176-
context text, vartype text, source text, min_val text, max_val text);
176+
context text, vartype text, source text, min_val text, max_val text, enumvals text);
177177

178178
CREATE RULE pg_settings_u AS
179179
ON UPDATE TO pg_settings

src/backend/tcop/postgres.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.543 2008/02/17 04:21:05 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.544 2008/03/10 12:55:13 mha Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -85,7 +85,7 @@ CommandDest whereToSendOutput = DestDebug;
8585
/* flag for logging end of session */
8686
bool Log_disconnections = false;
8787

88-
LogStmtLevel log_statement = LOGSTMT_NONE;
88+
int log_statement = LOGSTMT_NONE;
8989

9090
/* GUC variable for maximum stack depth (measured in kilobytes) */
9191
int max_stack_depth = 100;

src/backend/utils/error/elog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*
4343
*
4444
* IDENTIFICATION
45-
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.201 2008/01/01 19:45:53 momjian Exp $
45+
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.202 2008/03/10 12:55:13 mha Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -80,7 +80,7 @@ sigjmp_buf *PG_exception_stack = NULL;
8080
extern bool redirection_done;
8181

8282
/* GUC parameters */
83-
PGErrorVerbosity Log_error_verbosity = PGERROR_VERBOSE;
83+
int Log_error_verbosity = PGERROR_VERBOSE;
8484
char *Log_line_prefix = NULL; /* format for extra log line info */
8585
int Log_destination = LOG_DESTINATION_STDERR;
8686

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy