1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

> Joe Conway <mail@joeconway.com> writes:

>>ISTM that "source" is worth knowing.
>
> Hm, possibly.  Any other opinions?

This version has the seven fields I proposed, including "source". Here's
an example that shows why I think it's valuable:

regression=# \x
Expanded display is on.
regression=# select * from pg_settings where name = 'enable_seqscan';
-[ RECORD 1 ]-----------
name    | enable_seqscan
setting | on
context | user
vartype | bool
source  | default
min_val |
max_val |

regression=# update pg_settings set setting = 'off' where name =
'enable_seqscan';
-[ RECORD 1 ]---
set_config | off

regression=# select * from pg_settings where name = 'enable_seqscan';
-[ RECORD 1 ]-----------
name    | enable_seqscan
setting | off
context | user
vartype | bool
source  | session
min_val |
max_val |

regression=# alter user postgres set enable_seqscan to 'off';
ALTER USER

(log out and then back in again)

regression=# \x
Expanded display is on.
regression=# select * from pg_settings where name = 'enable_seqscan';
-[ RECORD 1 ]-----------
name    | enable_seqscan
setting | off
context | user
vartype | bool
source  | user
min_val |
max_val |

In the first case, enable_seqscan is set to its default value. After
setting it to off, it is obvious that the value has been changed for the
session only. In the third case, you can see that the value has been set
specifically for the user.

Joe Conway
This commit is contained in:
Bruce Momjian
2003-07-27 04:35:54 +00:00
parent a265b7f70a
commit 38fb906f93
8 changed files with 204 additions and 55 deletions

View File

@ -7,7 +7,7 @@
* Copyright 2000-2003 by PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* $Id: guc.h,v 1.35 2003/07/21 21:02:12 momjian Exp $
* $Id: guc.h,v 1.36 2003/07/27 04:35:54 momjian Exp $
*--------------------------------------------------------------------
*/
#ifndef GUC_H
@ -55,13 +55,13 @@
*/
typedef enum
{
PGC_INTERNAL,
PGC_POSTMASTER,
PGC_SIGHUP,
PGC_BACKEND,
PGC_SUSET,
PGC_USERLIMIT,
PGC_USERSET
PGC_INTERNAL = 0,
PGC_POSTMASTER = 1,
PGC_SIGHUP = 2,
PGC_BACKEND = 3,
PGC_SUSET = 4,
PGC_USERLIMIT = 5,
PGC_USERSET = 6
} GucContext;
/*
@ -73,6 +73,8 @@ typedef enum
* Sources <= PGC_S_OVERRIDE will set the default used by RESET, as well
* as the current value. Note that source == PGC_S_OVERRIDE should be
* used when setting a PGC_INTERNAL option.
*
* Keep in sync with GucSourceName in guc.c
*/
typedef enum
{
@ -92,7 +94,6 @@ typedef enum
PGC_S_SESSION = 9 /* SET command */
} GucSource;
/* GUC vars that are actually declared in guc.c, rather than elsewhere */
extern bool log_statement;
extern bool log_duration;
@ -132,7 +133,7 @@ extern bool set_config_option(const char *name, const char *value,
extern void ShowGUCConfigOption(const char *name, DestReceiver *dest);
extern void ShowAllGUCConfig(DestReceiver *dest);
extern char *GetConfigOptionByName(const char *name, const char **varname);
extern char *GetConfigOptionByNum(int varnum, const char **varname, bool *noshow);
extern void GetConfigOptionByNum(int varnum, const char **values, bool *noshow);
extern int GetNumConfigOptions(void);
extern void SetPGVariable(const char *name, List *args, bool is_local);

View File

@ -7,7 +7,7 @@
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
*
* $Id: guc_tables.h,v 1.1 2003/07/04 16:41:22 tgl Exp $
* $Id: guc_tables.h,v 1.2 2003/07/27 04:35:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -61,10 +61,10 @@ enum config_group
*/
enum config_type
{
PGC_BOOL,
PGC_INT,
PGC_REAL,
PGC_STRING
PGC_BOOL = 0,
PGC_INT = 1,
PGC_REAL = 2,
PGC_STRING = 3
};
/*