aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-04-25 19:45:10 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-04-25 19:45:10 +0000
commit9cbaf7217747d6b5c88ba9b500a37b8372f185c9 (patch)
tree18569f5cba46f81d9097c9ea21c29f4a0e055936 /src/include
parenta2190c9eb6afc65fddb80667d48024428368a9b6 (diff)
downloadpostgresql-9cbaf7217747d6b5c88ba9b500a37b8372f185c9.tar.gz
postgresql-9cbaf7217747d6b5c88ba9b500a37b8372f185c9.zip
In the continuing saga of FE/BE protocol revisions, add reporting of
initial values and runtime changes in selected parameters. This gets rid of the need for an initial 'select pg_client_encoding()' query in libpq, bringing us back to one message transmitted in each direction for a standard connection startup. To allow server version to be sent using the same GUC mechanism that handles other parameters, invent the concept of a never-settable GUC parameter: you can 'show server_version' but it's not settable by any GUC input source. Create 'lc_collate' and 'lc_ctype' never-settable parameters so that people can find out these settings without need for pg_controldata. (These side ideas were all discussed some time ago in pgsql-hackers, but not yet implemented.)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/commands/variable.h5
-rw-r--r--src/include/libpq/pqcomm.h4
-rw-r--r--src/include/utils/guc.h97
3 files changed, 50 insertions, 56 deletions
diff --git a/src/include/commands/variable.h b/src/include/commands/variable.h
index 73687178fe8..68a0ebf7450 100644
--- a/src/include/commands/variable.h
+++ b/src/include/commands/variable.h
@@ -2,7 +2,7 @@
* variable.h
* Routines for handling specialized SET variables.
*
- * $Id: variable.h,v 1.19 2002/09/04 20:31:42 momjian Exp $
+ * $Id: variable.h,v 1.20 2003/04/25 19:45:09 tgl Exp $
*
*/
#ifndef VARIABLE_H
@@ -22,9 +22,6 @@ extern bool assign_random_seed(double value,
extern const char *show_random_seed(void);
extern const char *assign_client_encoding(const char *value,
bool doit, bool interactive);
-extern const char *assign_server_encoding(const char *value,
- bool doit, bool interactive);
-extern const char *show_server_encoding(void);
extern const char *assign_session_authorization(const char *value,
bool doit, bool interactive);
extern const char *show_session_authorization(void);
diff --git a/src/include/libpq/pqcomm.h b/src/include/libpq/pqcomm.h
index 4f458c51c29..6a871c7c6f6 100644
--- a/src/include/libpq/pqcomm.h
+++ b/src/include/libpq/pqcomm.h
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqcomm.h,v 1.79 2003/04/24 21:16:44 tgl Exp $
+ * $Id: pqcomm.h,v 1.80 2003/04/25 19:45:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -106,7 +106,7 @@ typedef union SockAddr
/* The earliest and latest frontend/backend protocol version supported. */
#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(1,0)
-#define PG_PROTOCOL_LATEST PG_PROTOCOL(3,103) /* XXX temporary value */
+#define PG_PROTOCOL_LATEST PG_PROTOCOL(3,104) /* XXX temporary value */
typedef uint32 ProtocolVersion; /* FE/BE protocol version number */
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index f39f0a18544..47a5eeab187 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -1,10 +1,14 @@
-/*
+/*--------------------------------------------------------------------
* guc.h
*
* External declarations pertaining to backend/utils/misc/guc.c and
* backend/utils/misc/guc-file.l
*
- * $Id: guc.h,v 1.26 2002/11/15 00:47:22 momjian Exp $
+ * Copyright 2000-2003 by PostgreSQL Global Development Group
+ * Written by Peter Eisentraut <peter_e@gmx.net>.
+ *
+ * $Id: guc.h,v 1.27 2003/04/25 19:45:09 tgl Exp $
+ *--------------------------------------------------------------------
*/
#ifndef GUC_H
#define GUC_H
@@ -17,32 +21,37 @@
* Certain options can only be set at certain times. The rules are
* like this:
*
+ * INTERNAL options cannot be set by the user at all, but only through
+ * internal processes ("server_version" is an example). These are GUC
+ * variables only so they can be shown by SHOW, etc.
+ *
* POSTMASTER options can only be set when the postmaster starts,
* either from the configuration file or the command line.
*
* SIGHUP options can only be set at postmaster startup or by changing
* the configuration file and sending the HUP signal to the postmaster
* or a backend process. (Notice that the signal receipt will not be
- * evaluated immediately. The postmaster and the backend block at a
+ * evaluated immediately. The postmaster and the backend check it at a
* certain point in their main loop. It's safer to wait than to read a
* file asynchronously.)
*
* BACKEND options can only be set at postmaster startup, from the
- * configuration file, or with the PGOPTIONS variable from the client
- * when the connection is initiated. Furthermore, an already-started
- * backend will ignore changes to such an option in the configuration
- * file. The idea is that these options are fixed for a given backend
- * once it's started, but they can vary across backends.
+ * configuration file, or by client request in the connection startup
+ * packet (e.g., from libpq's PGOPTIONS variable). Furthermore, an
+ * already-started backend will ignore changes to such an option in the
+ * configuration file. The idea is that these options are fixed for a
+ * given backend once it's started, but they can vary across backends.
*
* SUSET options can be set at postmaster startup, with the SIGHUP
* mechanism, or from SQL if you're a superuser. These options cannot
- * be set using the PGOPTIONS mechanism, because there is not check as
- * to who does this.
+ * be set in the connection startup packet, because when it is processed
+ * we don't yet know if the user is a superuser.
*
* USERSET options can be set by anyone any time.
*/
typedef enum
{
+ PGC_INTERNAL,
PGC_POSTMASTER,
PGC_SIGHUP,
PGC_BACKEND,
@@ -57,7 +66,8 @@ typedef enum
* override the postmaster command line.) Tracking the source allows us
* to process sources in any convenient order without affecting results.
* Sources <= PGC_S_OVERRIDE will set the default used by RESET, as well
- * as the current value.
+ * as the current value. Note that source == PGC_S_OVERRIDE should be
+ * used when setting a PGC_INTERNAL option.
*/
typedef enum
{
@@ -67,11 +77,35 @@ typedef enum
PGC_S_ARGV = 3, /* postmaster command line */
PGC_S_DATABASE = 4, /* per-database setting */
PGC_S_USER = 5, /* per-user setting */
- PGC_S_CLIENT = 6, /* from client (PGOPTIONS) */
+ PGC_S_CLIENT = 6, /* from client connection request */
PGC_S_OVERRIDE = 7, /* special case to forcibly set default */
PGC_S_SESSION = 8 /* SET command */
} GucSource;
+
+/* GUC vars that are actually declared in guc.c, rather than elsewhere */
+extern bool log_statement;
+extern bool log_duration;
+extern bool Debug_print_plan;
+extern bool Debug_print_parse;
+extern bool Debug_print_rewritten;
+extern bool Debug_pretty_print;
+extern bool Explain_pretty_print;
+
+extern bool log_parser_stats;
+extern bool log_planner_stats;
+extern bool log_executor_stats;
+extern bool log_statement_stats;
+extern bool log_btree_build_stats;
+
+extern bool SQL_inheritance;
+extern bool Australian_timezones;
+
+extern int log_min_error_statement;
+extern int log_min_messages;
+extern int client_min_messages;
+
+
extern void SetConfigOption(const char *name, const char *value,
GucContext context, GucSource source);
extern const char *GetConfigOption(const char *name);
@@ -80,6 +114,7 @@ extern void ProcessConfigFile(GucContext context);
extern void InitializeGUCOptions(void);
extern void ResetAllOptions(void);
extern void AtEOXact_GUC(bool isCommit);
+extern void BeginReportingGUCOptions(void);
extern void ParseLongOption(const char *string, char **name, char **value);
extern bool set_config_option(const char *name, const char *value,
GucContext context, GucSource source,
@@ -100,42 +135,4 @@ extern void ProcessGUCArray(ArrayType *array, GucSource source);
extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value);
extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name);
-extern const char *assign_min_error_statement(const char *newval, bool doit,
- bool interactive);
-
-extern const char *assign_log_min_messages(const char *newval,
- bool doit, bool interactive);
-extern const char *assign_client_min_messages(const char *newval,
- bool doit, bool interactive);
-extern bool log_statement;
-extern bool log_duration;
-extern bool Debug_print_plan;
-extern bool Debug_print_parse;
-extern bool Debug_print_rewritten;
-extern bool Debug_pretty_print;
-
-extern bool log_parser_stats;
-extern bool log_planner_stats;
-extern bool log_executor_stats;
-extern bool log_statement_stats;
-extern bool log_btree_build_stats;
-
-extern bool Explain_pretty_print;
-
-extern bool SQL_inheritance;
-extern bool Australian_timezones;
-
-extern int log_min_error_statement;
-extern char *log_min_error_statement_str;
-extern const char log_min_error_statement_str_default[];
-
-extern int log_min_messages;
-extern char *log_min_messages_str;
-extern const char log_min_messages_str_default[];
-
-extern int client_min_messages;
-extern char *client_min_messages_str;
-
-extern const char client_min_messages_str_default[];
-
#endif /* GUC_H */