Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ow93L-0004cy-V8 for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Nov 2022 21:37:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ow93K-0005T4-Na for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Nov 2022 21:37:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ow93K-0005Sv-1j for pgsql-hackers@lists.postgresql.org; Fri, 18 Nov 2022 21:37:38 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ow93G-0006Uv-62 for pgsql-hackers@postgresql.org; Fri, 18 Nov 2022 21:37:36 +0000 Received: by mail-io1-xd2c.google.com with SMTP id p184so4794774iof.11 for ; Fri, 18 Nov 2022 13:37:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=ToGzrHw4ezzCvsM8M0GDS6559VjuzvgeGW+LylLbihU=; b=dgmdsc5RXeORYZA2zhNS9ojLMGBNFq0ZWtSAvjgZFVJ/ppjAU1iR2+HBn9Wg3m2WZC qtWU9kenT56kxKNbD2np55kao7yzXFBCvn2c7LEIChNAJ/70o3ayWAE94UdtamDuFU25 C5pjAwPAOu3jWi+InUmHVHgxjNlzqFvpOxJDKYwARi8Wg8qjTFOgrP0tj8FAaaX91mLv AirwS6kvvA7O09WscC4Yo4/rHPqmsePjFQ+BzVA3ioqG7i/UZX+rNdYkOC6srhpAJET0 yDVSHetC4Zwyifh8niJjNdJAGg17X3xfttFdJuU7U22OGb1FI51CyemnZgCacd7D5rRu 7P9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ToGzrHw4ezzCvsM8M0GDS6559VjuzvgeGW+LylLbihU=; b=GJw+yZTJagE1SVMSpXdIv3GYS9BeqsShlXRTFd3MbG1l9nv3xGG1eIDTsoZgvyncno YcNyuhk6YBuTtUeS1W4o3QW8n6znzjfA423lvH5/iQcDdl747RvTc4RGTY56+chX5Omp t/pfeIour30HZLscuyzC5761ILRIoxzVCngINsDRLfxO3Drb0oh09pcc+4WYyndP1zR3 KP6xrzgbKYMo1jTFAs9j5prLKM1aMZPTmv2NUcgAp/usBawVil3Zsnc3rpFRhVwfNdtY 4j5mI0+ZUsYFStTheW40fjiCqltWFdV2PhUzQmhMIpPrWOLBqwEEYIFAClpbR9tHe6Y/ UutA== X-Gm-Message-State: ANoB5plLDSDfsiuC+7J7xzBmqQKEFplZ6VC9xgQLj0QRyUVlnu1mjMvV SY4qkw1DfDU1mf8DjWzxIOwgUg== X-Google-Smtp-Source: AA0mqf5rJoVKtpsSOI68Tj7e8NDfsbluDGERDPFinDt7284xOaOqeQcRUMMzPjp5ajuGpjySDc8XRg== X-Received: by 2002:a02:c764:0:b0:363:b895:bc7e with SMTP id k4-20020a02c764000000b00363b895bc7emr3601191jao.212.1668807453189; Fri, 18 Nov 2022 13:37:33 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id 69-20020a021148000000b00374f99a3de5sm1616889jaf.63.2022.11.18.13.37.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Nov 2022 13:37:32 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 97F258007CC; Fri, 18 Nov 2022 15:37:31 -0600 (CST) Date: Fri, 18 Nov 2022 15:37:31 -0600 From: Justin Pryzby To: Kyotaro Horiguchi Cc: michael@paquier.xyz, andres@anarazel.de, nathandbossart@gmail.com, pgsql-hackers@postgresql.org, Peter Smith Subject: Re: fix stats_fetch_consistency value in postgresql.conf.sample Message-ID: <20221118213731.GM11463@telsasoft.com> References: <20220728222734.GA1913@telsasoft.com> <20220913004303.GM31833@telsasoft.com> <20220918045306.GT31833@telsasoft.com> <20220926.172958.1790193605025533956.horikyota.ntt@gmail.com> <20221024220544.GJ16921@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="IpbVkmxF4tDyP/Kb" Content-Disposition: inline In-Reply-To: <20221024220544.GJ16921@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --IpbVkmxF4tDyP/Kb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline @cfbot: re-rebased again --IpbVkmxF4tDyP/Kb Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-pg_settings_get_flags-add-DEFAULT_COMPILE-and-DEFAUL.patch" From e1f0940e7682052b2ec9d58c361f56630aa1742e Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Tue, 19 Jul 2022 08:31:56 -0500 Subject: [PATCH 1/2] pg_settings_get_flags(): add DEFAULT_COMPILE and DEFAULT_INITDB .. for settings which vary by ./configure or platform or initdb Note that this is independent from PGC_S_DYNAMIC_DEFAULT. --- doc/src/sgml/func.sgml | 15 ++++++ src/backend/utils/misc/guc_funcs.c | 6 ++- src/backend/utils/misc/guc_tables.c | 76 ++++++++++++++++++----------- src/include/utils/guc.h | 2 + 4 files changed, 69 insertions(+), 30 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 82fba48d5f7..67c68fc9292 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -24377,6 +24377,21 @@ SELECT collation for ('foo' COLLATE "de_DE"); FlagDescription + + + DEFAULT_COMPILE + Parameters with this flag have default values which vary by + platform, or compile-time options. + + + + + DEFAULT_INITDB + Parameters with this flag have default values which are + determined dynamically during initdb. + + + EXPLAIN Parameters with this flag are included in diff --git a/src/backend/utils/misc/guc_funcs.c b/src/backend/utils/misc/guc_funcs.c index 108b3bd1290..2b666e8d014 100644 --- a/src/backend/utils/misc/guc_funcs.c +++ b/src/backend/utils/misc/guc_funcs.c @@ -538,7 +538,7 @@ ShowAllGUCConfig(DestReceiver *dest) Datum pg_settings_get_flags(PG_FUNCTION_ARGS) { -#define MAX_GUC_FLAGS 6 +#define MAX_GUC_FLAGS 8 char *varname = TextDatumGetCString(PG_GETARG_DATUM(0)); struct config_generic *record; int cnt = 0; @@ -551,6 +551,10 @@ pg_settings_get_flags(PG_FUNCTION_ARGS) if (record == NULL) PG_RETURN_NULL(); + if (record->flags & GUC_DEFAULT_COMPILE) + flags[cnt++] = CStringGetTextDatum("DEFAULT_COMPILE"); + if (record->flags & GUC_DEFAULT_INITDB) + flags[cnt++] = CStringGetTextDatum("DEFAULT_INITDB"); if (record->flags & GUC_EXPLAIN) flags[cnt++] = CStringGetTextDatum("EXPLAIN"); if (record->flags & GUC_NO_RESET) diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index e5cc4e3205a..6bd206c164a 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -1205,7 +1205,7 @@ struct config_bool ConfigureNamesBool[] = {"debug_assertions", PGC_INTERNAL, PRESET_OPTIONS, gettext_noop("Shows whether the running server has assertion checks enabled."), NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_DEFAULT_COMPILE }, &assert_enabled, DEFAULT_ASSERT_ENABLED, @@ -1377,7 +1377,8 @@ struct config_bool ConfigureNamesBool[] = { {"update_process_title", PGC_SUSET, PROCESS_TITLE, gettext_noop("Updates the process title to show the active SQL command."), - gettext_noop("Enables updating of the process title every time a new SQL command is received by the server.") + gettext_noop("Enables updating of the process title every time a new SQL command is received by the server."), + GUC_DEFAULT_COMPILE }, &update_process_title, DEFAULT_UPDATE_PROCESS_TITLE, @@ -2122,7 +2123,8 @@ struct config_int ConfigureNamesInt[] = { {"max_connections", PGC_POSTMASTER, CONN_AUTH_SETTINGS, gettext_noop("Sets the maximum number of concurrent connections."), - NULL + NULL, + GUC_DEFAULT_INITDB }, &MaxConnections, 100, 1, MAX_BACKENDS, @@ -2159,7 +2161,7 @@ struct config_int ConfigureNamesInt[] = {"shared_buffers", PGC_POSTMASTER, RESOURCES_MEM, gettext_noop("Sets the number of shared memory buffers used by the server."), NULL, - GUC_UNIT_BLOCKS + GUC_UNIT_BLOCKS | GUC_DEFAULT_INITDB }, &NBuffers, 16384, 16, INT_MAX / 2, @@ -2202,7 +2204,8 @@ struct config_int ConfigureNamesInt[] = { {"port", PGC_POSTMASTER, CONN_AUTH_SETTINGS, gettext_noop("Sets the TCP port the server listens on."), - NULL + NULL, + GUC_DEFAULT_COMPILE }, &PostPortNumber, DEF_PGPORT, 1, 65535, @@ -2231,7 +2234,8 @@ struct config_int ConfigureNamesInt[] = "to be a numeric mode specification in the form " "accepted by the chmod and umask system calls. " "(To use the customary octal format the number must " - "start with a 0 (zero).)") + "start with a 0 (zero).)"), + GUC_DEFAULT_INITDB }, &Log_file_mode, 0600, 0000, 0777, @@ -2673,7 +2677,7 @@ struct config_int ConfigureNamesInt[] = {"checkpoint_flush_after", PGC_SIGHUP, WAL_CHECKPOINTS, gettext_noop("Number of pages after which previously performed writes are flushed to disk."), NULL, - GUC_UNIT_BLOCKS + GUC_UNIT_BLOCKS | GUC_DEFAULT_COMPILE }, &checkpoint_flush_after, DEFAULT_CHECKPOINT_FLUSH_AFTER, 0, WRITEBACK_MAX_PENDING_FLUSHES, @@ -2891,7 +2895,7 @@ struct config_int ConfigureNamesInt[] = {"bgwriter_flush_after", PGC_SIGHUP, RESOURCES_BGWRITER, gettext_noop("Number of pages after which previously performed writes are flushed to disk."), NULL, - GUC_UNIT_BLOCKS + GUC_UNIT_BLOCKS | GUC_DEFAULT_COMPILE }, &bgwriter_flush_after, DEFAULT_BGWRITER_FLUSH_AFTER, 0, WRITEBACK_MAX_PENDING_FLUSHES, @@ -2904,7 +2908,7 @@ struct config_int ConfigureNamesInt[] = RESOURCES_ASYNCHRONOUS, gettext_noop("Number of simultaneous requests that can be handled efficiently by the disk subsystem."), NULL, - GUC_EXPLAIN + GUC_EXPLAIN | GUC_DEFAULT_COMPILE }, &effective_io_concurrency, DEFAULT_EFFECTIVE_IO_CONCURRENCY, @@ -2918,7 +2922,7 @@ struct config_int ConfigureNamesInt[] = RESOURCES_ASYNCHRONOUS, gettext_noop("A variant of effective_io_concurrency that is used for maintenance work."), NULL, - GUC_EXPLAIN + GUC_EXPLAIN | GUC_DEFAULT_COMPILE }, &maintenance_io_concurrency, DEFAULT_MAINTENANCE_IO_CONCURRENCY, @@ -2931,7 +2935,7 @@ struct config_int ConfigureNamesInt[] = {"backend_flush_after", PGC_USERSET, RESOURCES_ASYNCHRONOUS, gettext_noop("Number of pages after which previously performed writes are flushed to disk."), NULL, - GUC_UNIT_BLOCKS + GUC_UNIT_BLOCKS | GUC_DEFAULT_COMPILE }, &backend_flush_after, DEFAULT_BACKEND_FLUSH_AFTER, 0, WRITEBACK_MAX_PENDING_FLUSHES, @@ -3385,7 +3389,7 @@ struct config_int ConfigureNamesInt[] = {"debug_discard_caches", PGC_SUSET, DEVELOPER_OPTIONS, gettext_noop("Aggressively flush system caches for debugging purposes."), NULL, - GUC_NOT_IN_SAMPLE + GUC_NOT_IN_SAMPLE | GUC_DEFAULT_COMPILE }, &debug_discard_caches, #ifdef DISCARD_CACHES_ENABLED @@ -3878,7 +3882,8 @@ struct config_string ConfigureNamesString[] = { {"log_timezone", PGC_SIGHUP, LOGGING_WHAT, gettext_noop("Sets the time zone to use in log messages."), - NULL + NULL, + GUC_DEFAULT_INITDB }, &log_timezone_string, "GMT", @@ -3890,7 +3895,7 @@ struct config_string ConfigureNamesString[] = gettext_noop("Sets the display format for date and time values."), gettext_noop("Also controls interpretation of ambiguous " "date inputs."), - GUC_LIST_INPUT | GUC_REPORT + GUC_LIST_INPUT | GUC_REPORT | GUC_DEFAULT_INITDB }, &datestyle_string, "ISO, MDY", @@ -3992,7 +3997,8 @@ struct config_string ConfigureNamesString[] = { {"lc_messages", PGC_SUSET, CLIENT_CONN_LOCALE, gettext_noop("Sets the language in which messages are displayed."), - NULL + NULL, + GUC_DEFAULT_INITDB }, &locale_messages, "", @@ -4002,7 +4008,8 @@ struct config_string ConfigureNamesString[] = { {"lc_monetary", PGC_USERSET, CLIENT_CONN_LOCALE, gettext_noop("Sets the locale for formatting monetary amounts."), - NULL + NULL, + GUC_DEFAULT_INITDB }, &locale_monetary, "C", @@ -4012,7 +4019,8 @@ struct config_string ConfigureNamesString[] = { {"lc_numeric", PGC_USERSET, CLIENT_CONN_LOCALE, gettext_noop("Sets the locale for formatting numbers."), - NULL + NULL, + GUC_DEFAULT_INITDB }, &locale_numeric, "C", @@ -4022,7 +4030,8 @@ struct config_string ConfigureNamesString[] = { {"lc_time", PGC_USERSET, CLIENT_CONN_LOCALE, gettext_noop("Sets the locale for formatting date and time values."), - NULL + NULL, + GUC_DEFAULT_INITDB }, &locale_time, "C", @@ -4181,7 +4190,8 @@ struct config_string ConfigureNamesString[] = {"TimeZone", PGC_USERSET, CLIENT_CONN_LOCALE, gettext_noop("Sets the time zone for displaying and interpreting time stamps."), NULL, - GUC_REPORT + GUC_REPORT | GUC_DEFAULT_INITDB + }, &timezone_string, "GMT", @@ -4212,7 +4222,7 @@ struct config_string ConfigureNamesString[] = {"unix_socket_directories", PGC_POSTMASTER, CONN_AUTH_SETTINGS, gettext_noop("Sets the directories where Unix-domain sockets will be created."), NULL, - GUC_LIST_INPUT | GUC_LIST_QUOTE | GUC_SUPERUSER_ONLY + GUC_LIST_INPUT | GUC_LIST_QUOTE | GUC_SUPERUSER_ONLY | GUC_DEFAULT_COMPILE }, &Unix_socket_directories, DEFAULT_PGSOCKET_DIR, @@ -4293,7 +4303,7 @@ struct config_string ConfigureNamesString[] = {"ssl_library", PGC_INTERNAL, PRESET_OPTIONS, gettext_noop("Shows the name of the SSL library."), NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_DEFAULT_COMPILE }, &ssl_library, #ifdef USE_SSL @@ -4368,7 +4378,9 @@ struct config_string ConfigureNamesString[] = { {"default_text_search_config", PGC_USERSET, CLIENT_CONN_LOCALE, gettext_noop("Sets default text search configuration."), - NULL + NULL, + GUC_DEFAULT_INITDB + }, &TSCurrentConfig, "pg_catalog.simple", @@ -4379,7 +4391,7 @@ struct config_string ConfigureNamesString[] = {"ssl_ciphers", PGC_SIGHUP, CONN_AUTH_SSL, gettext_noop("Sets the list of allowed SSL ciphers."), NULL, - GUC_SUPERUSER_ONLY + GUC_SUPERUSER_ONLY | GUC_DEFAULT_COMPILE }, &SSLCipherSuites, #ifdef USE_OPENSSL @@ -4394,7 +4406,7 @@ struct config_string ConfigureNamesString[] = {"ssl_ecdh_curve", PGC_SIGHUP, CONN_AUTH_SSL, gettext_noop("Sets the curve to use for ECDH."), NULL, - GUC_SUPERUSER_ONLY + GUC_SUPERUSER_ONLY | GUC_DEFAULT_COMPILE }, &SSLECDHCurve, #ifdef USE_SSL @@ -4632,7 +4644,8 @@ struct config_enum ConfigureNamesEnum[] = { {"syslog_facility", PGC_SIGHUP, LOGGING_WHERE, gettext_noop("Sets the syslog \"facility\" to be used when syslog enabled."), - NULL + NULL, + GUC_DEFAULT_COMPILE }, &syslog_facility, DEFAULT_SYSLOG_FACILITY, @@ -4741,7 +4754,9 @@ struct config_enum ConfigureNamesEnum[] = { {"dynamic_shared_memory_type", PGC_POSTMASTER, RESOURCES_MEM, gettext_noop("Selects the dynamic shared memory implementation used."), - NULL + NULL, + /* platform-specific default, which is also overriden during initdb */ + GUC_DEFAULT_COMPILE | GUC_DEFAULT_INITDB }, &dynamic_shared_memory_type, DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE, dynamic_shared_memory_options, @@ -4751,7 +4766,8 @@ struct config_enum ConfigureNamesEnum[] = { {"shared_memory_type", PGC_POSTMASTER, RESOURCES_MEM, gettext_noop("Selects the shared memory implementation used for the main shared memory region."), - NULL + NULL, + GUC_DEFAULT_COMPILE }, &shared_memory_type, DEFAULT_SHARED_MEMORY_TYPE, shared_memory_options, @@ -4761,7 +4777,8 @@ struct config_enum ConfigureNamesEnum[] = { {"wal_sync_method", PGC_SIGHUP, WAL_SETTINGS, gettext_noop("Selects the method used for forcing WAL updates to disk."), - NULL + NULL, + GUC_DEFAULT_COMPILE }, &sync_method, DEFAULT_SYNC_METHOD, sync_method_options, @@ -4823,7 +4840,8 @@ struct config_enum ConfigureNamesEnum[] = { {"password_encryption", PGC_USERSET, CONN_AUTH_AUTH, gettext_noop("Chooses the algorithm for encrypting passwords."), - NULL + NULL, + GUC_DEFAULT_INITDB }, &Password_encryption, PASSWORD_TYPE_SCRAM_SHA_256, password_encryption_options, diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index b3aaff9665b..79053583a03 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -221,6 +221,8 @@ typedef enum #define GUC_DISALLOW_IN_AUTO_FILE \ 0x002000 /* can't set in PG_AUTOCONF_FILENAME */ #define GUC_RUNTIME_COMPUTED 0x004000 /* delay processing in 'postgres -C' */ +#define GUC_DEFAULT_COMPILE 0x008000 /* default is determined at compile time */ +#define GUC_DEFAULT_INITDB 0x010000 /* default is determined at during initdb */ #define GUC_UNIT_KB 0x01000000 /* value is in kilobytes */ #define GUC_UNIT_BLOCKS 0x02000000 /* value is in blocks */ -- 2.25.1 --IpbVkmxF4tDyP/Kb Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-WIP-test-GUC-default-values.patch" From 8ba199da40fc44c851224d6b088a15e4464c2419 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Wed, 25 May 2022 05:14:43 -0500 Subject: [PATCH 2/2] WIP: test GUC default values --- src/backend/utils/misc/postgresql.conf.sample | 2 +- src/test/modules/test_misc/t/003_check_guc.pl | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 1ce0dee6d04..21bfbef3291 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -720,7 +720,7 @@ # share/timezonesets/. #extra_float_digits = 1 # min -15, max 3; any value >0 actually # selects precise output mode -#client_encoding = sql_ascii # actually, defaults to database +#client_encoding = SQL_ASCII # actually, defaults to database # encoding # These settings are initialized by initdb, but they can be changed. diff --git a/src/test/modules/test_misc/t/003_check_guc.pl b/src/test/modules/test_misc/t/003_check_guc.pl index 1786cd19299..22e8612350c 100644 --- a/src/test/modules/test_misc/t/003_check_guc.pl +++ b/src/test/modules/test_misc/t/003_check_guc.pl @@ -106,4 +106,37 @@ foreach my $param (@sample_intersect) ); } +# Test that GUCs in postgresql.conf.sample show the correct default values +my $check_defaults = $node->safe_psql( + 'postgres', + " + CREATE TABLE sample_conf AS + SELECT m[1] AS name, COALESCE(m[3], m[5]) AS sample_value + FROM (SELECT regexp_split_to_table(pg_read_file('$sample_file'), '\n') AS ln) conf, + regexp_match(ln, '^#?([_[:alpha:]]+) (= ''([^'']*)''|(= ([^[:space:]]*))).*') AS m + WHERE ln ~ '^#?[[:alpha:]]' + "); + +$check_defaults = $node->safe_psql( + 'postgres', + " + SELECT name, current_setting(name), sc.sample_value, boot_val + FROM pg_show_all_settings() psas + JOIN sample_conf sc USING(name) + WHERE sc.sample_value != boot_val -- same value (specified by Cluster.pm) + AND sc.sample_value != current_setting(name) -- same value, with human units + AND sc.sample_value != current_setting(name)||'.0' -- same value with .0 suffix + AND 'DEFAULT_COMPILE' != ALL(pg_settings_get_flags(psas.name)) -- dynamically-set defaults + AND 'DEFAULT_INITDB' != ALL(pg_settings_get_flags(psas.name)) -- dynamically-set defaults + AND NOT (sc.sample_value ~ '^0' AND current_setting(name) ~ '^0') -- zeros may be written differently + AND NOT (sc.sample_value='60s' AND current_setting(name) = '1min') -- two ways to write 1min + AND name NOT IN ('krb_server_keyfile', 'wal_retrieve_retry_interval', 'log_autovacuum_min_duration'); -- exceptions + "); + +my @check_defaults_array = split("\n", lc($check_defaults)); +print(STDERR "$check_defaults\n"); + +is (@check_defaults_array, 0, + 'check for consistency of defaults in postgresql.conf.sample'); + done_testing(); -- 2.25.1 --IpbVkmxF4tDyP/Kb--