Raw parse tree is not dumped to log
Hi,
When "debug_print_parse" is "on", only the Query structure tree is dumped,
the raw parse tree is not dumped to log. In some cases, viewing raw parse
trees are also helpful. It is very hard to view a tree by watching
variables in a debugger, so I added the following code in my local:
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 0cecd464902..ff456d1d94e 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (Debug_print_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
return raw_parsetree_list;
}
Before submitting this trivial patch, I still want to confirm with the
community if it's intentional to not dump raw parse tree? If we really
don't want to dump raw parse tree again "debug_print_parse", are you ok to
add a new option "debug_print_raw_parse"?
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/
Chao Li <li.evan.chao@gmail.com> 于2025年8月1日周五 13:44写道:
Hi,
When "debug_print_parse" is "on", only the Query structure tree is
dumped, the raw parse tree is not dumped to log. In some cases, viewing raw
parse trees are also helpful. It is very hard to view a tree by watching
variables in a debugger, so I added the following code in my local:
When I debug the code, I care more about Query structure,
debug_print_parse is enough for me.
In the debugger, various tools are available, including nodeToString() and
Python scripts.
I usually use the gdbpg tools in [1]https://github.com/tvondra/gdbpg. But it was too old. It can't support
the newest version well.
[1]: https://github.com/tvondra/gdbpg
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 0cecd464902..ff456d1d94e 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (Debug_print_parse) + elog_node_display(LOG, "raw parse tree", raw_parsetree_list, + Debug_pretty_print); + return raw_parsetree_list; }Before submitting this trivial patch, I still want to confirm with the
community if it's intentional to not dump raw parse tree? If we really
don't want to dump raw parse tree again "debug_print_parse", are you ok to
add a new option "debug_print_raw_parse"?
If you want to add this, I prefer to "debug_print_raw_parse". You should
also add documentation to explain this new GUC.
--
Thanks,
Tender Wang
Before submitting this trivial patch, I still want to confirm with the
community if it's intentional to not dump raw parse tree?
For your reference, here's the past discussion:
/messages/by-id/20080730.172949.132921436.t-ishii@sraoss.co.jp
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Hi Tatsuo, thanks for pointing out the past conversation.
So, the requirement got 1 more vote from me. But to not make noise to
people who are not interested in raw parse tree, I guess it's better to add
a new option "debug_print_raw_parse". For people who are interested in raw
parse tree, turning on a flag once is much more convenient than typing a
command in the debugger for every trace.
I will wait to see if Tom still objects to adding that. I will not make the
code change unless I see a hint of "go".
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/
Tatsuo Ishii <ishii@postgresql.org> 于2025年8月1日周五 15:18写道:
Show quoted text
Before submitting this trivial patch, I still want to confirm with the
community if it's intentional to not dump raw parse tree?For your reference, here's the past discussion:
/messages/by-id/20080730.172949.132921436.t-ishii@sraoss.co.jp
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
I was reviewing some patches today, and during debugging the patches, I
wanted to view raw parse tree, so I had to apply my local patch of dumping
raw parse for every review, which was so inconvenient.
You may argue that raw parse tree might not be useful for every reviews. I
am still ramping up PG development, I'd like to tune SQL statements and see
differences of resulting parse trees.
So, I made this patch. The change is quiet simple. I just searched for
"Debug_print_parse", and added a new option "Debug_print_raw_parse". Only
when the new option is turned on, raw parse tree will be dumped to logs.
This way will not make noise to people who are not interested in raw parse
tree.
I have run the following tests:
1. In an existing database, edit postgres.conf and add
"debug_print_raw_parse = on", then raw parse tree is dumped to logs as
expected.
2. Init a new database, "debug_print_raw_parse = off" appears in
postgres.conf as expected.
3. "make check" passed
This patches touches config.sgml and rules.sgml, I don't know how to test
the doc changes, any suggestion?
One thing I want reviewer's opinion is that, if start "postgres -d 3", it
originally only turn on debug_print_parse, now it will turn on
debug_print_raw_parse as well, which potentially make people who don't want
raw parse tree unhappy. Maybe use "-d 5" or not turning on
debug_print_raw_parse at all by "-d"? WDYT?
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/
Chao Li <li.evan.chao@gmail.com> 于2025年8月1日周五 16:10写道:
Show quoted text
Hi Tatsuo, thanks for pointing out the past conversation.
So, the requirement got 1 more vote from me. But to not make noise to
people who are not interested in raw parse tree, I guess it's better to add
a new option "debug_print_raw_parse". For people who are interested in raw
parse tree, turning on a flag once is much more convenient than typing a
command in the debugger for every trace.I will wait to see if Tom still objects to adding that. I will not make
the code change unless I see a hint of "go".Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Tatsuo Ishii <ishii@postgresql.org> 于2025年8月1日周五 15:18写道:
Before submitting this trivial patch, I still want to confirm with the
community if it's intentional to not dump raw parse tree?For your reference, here's the past discussion:
/messages/by-id/20080730.172949.132921436.t-ishii@sraoss.co.jp
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Oh, I forget to attached the patch file, here comes it.
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/
Chao Li <li.evan.chao@gmail.com> 于2025年8月4日周一 15:53写道:
Show quoted text
I was reviewing some patches today, and during debugging the patches, I
wanted to view raw parse tree, so I had to apply my local patch of dumping
raw parse for every review, which was so inconvenient.You may argue that raw parse tree might not be useful for every reviews. I
am still ramping up PG development, I'd like to tune SQL statements and see
differences of resulting parse trees.So, I made this patch. The change is quiet simple. I just searched for
"Debug_print_parse", and added a new option "Debug_print_raw_parse". Only
when the new option is turned on, raw parse tree will be dumped to logs.
This way will not make noise to people who are not interested in raw parse
tree.I have run the following tests:
1. In an existing database, edit postgres.conf and add
"debug_print_raw_parse = on", then raw parse tree is dumped to logs as
expected.
2. Init a new database, "debug_print_raw_parse = off" appears in
postgres.conf as expected.
3. "make check" passedThis patches touches config.sgml and rules.sgml, I don't know how to test
the doc changes, any suggestion?One thing I want reviewer's opinion is that, if start "postgres -d 3", it
originally only turn on debug_print_parse, now it will turn on
debug_print_raw_parse as well, which potentially make people who don't want
raw parse tree unhappy. Maybe use "-d 5" or not turning on
debug_print_raw_parse at all by "-d"? WDYT?Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Chao Li <li.evan.chao@gmail.com> 于2025年8月1日周五 16:10写道:
Hi Tatsuo, thanks for pointing out the past conversation.
So, the requirement got 1 more vote from me. But to not make noise to
people who are not interested in raw parse tree, I guess it's better to add
a new option "debug_print_raw_parse". For people who are interested in raw
parse tree, turning on a flag once is much more convenient than typing a
command in the debugger for every trace.I will wait to see if Tom still objects to adding that. I will not make
the code change unless I see a hint of "go".Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Tatsuo Ishii <ishii@postgresql.org> 于2025年8月1日周五 15:18写道:
Before submitting this trivial patch, I still want to confirm with the
community if it's intentional to not dump raw parse tree?For your reference, here's the past discussion:
/messages/by-id/20080730.172949.132921436.t-ishii@sraoss.co.jp
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Attachments:
v1-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchapplication/octet-stream; name=v1-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchDownload
From 0e21d7e4ae09eb2d11f7bb0c3e6cf4ef8919cec4 Mon Sep 17 00:00:00 2001
From: "Chao Li (HighGo Inc.)" <li.evan.chao@gmail.com>
Date: Thu, 31 Jul 2025 17:02:32 +0800
Subject: [PATCH v1] Add support for dumping raw parse tree with
debug_print_raw_parse
This patch introduces a small change to log the raw parse tree in the
same way we currently log the parse tree, rewritten tree, and plan tree.
While tracing some queries, I found that being able to inspect the raw
parse tree is also helpful for understanding query transformation.
Although the raw parse tree can be inspected via a debugger, having it
logged simplifies the workflow for those interested in this stage of
query processing, without requiring a debugging session.
To avoid unnecessary log noise for users not interested in this detail,
a new GUC option, "debug_print_raw_parse", has been added.
When starting the PostgreSQL process with "-d N", and N is 3 or higher,
debug_print_raw_parse is enabled automatically, alongside
debug_print_parse.
Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAEoWx2mcO0Gpo4vd8kPMAFWeJLSp0MeUUnaLdE1x0tSVd-VzUw%40mail.gmail.com
---
doc/src/sgml/config.sgml | 8 +-
src/backend/tcop/postgres.c | 7 +
src/backend/utils/misc/guc_tables.c | 2595 ++++++++---------
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/include/utils/guc.h | 1 +
5 files changed, 1269 insertions(+), 1343 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 20ccb2d6b54..4370e8307f2 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7382,6 +7382,11 @@ local0.* /var/log/postgresql
</varlistentry>
<varlistentry id="guc-debug-print-parse">
+ <term><varname>debug_print_raw_parse</varname> (<type>boolean</type>)
+ <indexterm>
+ <primary><varname>debug_print_raw_parse</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
<term><varname>debug_print_parse</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>debug_print_parse</varname> configuration parameter</primary>
@@ -7421,7 +7426,8 @@ local0.* /var/log/postgresql
<listitem>
<para>
When set, <varname>debug_pretty_print</varname> indents the messages
- produced by <varname>debug_print_parse</varname>,
+ produced by <varname>debug_print_raw_parse</varname>,
+ <varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. This results in more readable
but much longer output than the <quote>compact</quote> format used when
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 0cecd464902..d356830f756 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (Debug_print_raw_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
return raw_parsetree_list;
}
@@ -3697,7 +3701,10 @@ set_debug_options(int debug_flag, GucContext context, GucSource source)
if (debug_flag >= 2)
SetConfigOption("log_statement", "all", context, source);
if (debug_flag >= 3)
+ {
+ SetConfigOption("debug_print_raw_parse", "true", context, source);
SetConfigOption("debug_print_parse", "true", context, source);
+ }
if (debug_flag >= 4)
SetConfigOption("debug_print_plan", "true", context, source);
if (debug_flag >= 5)
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index d14b1678e7f..0a5910524c5 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -507,6 +507,7 @@ bool AllowAlterSystem = true;
bool log_duration = false;
bool Debug_print_plan = false;
bool Debug_print_parse = false;
+bool Debug_print_raw_parse = false;
bool Debug_print_rewritten = false;
bool Debug_pretty_print = true;
@@ -788,1366 +789,1276 @@ StaticAssertDecl(lengthof(config_type_names) == (PGC_ENUM + 1),
*/
struct config_bool ConfigureNamesBool[] =
-{
- {
- {"enable_seqscan", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of sequential-scan plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_seqscan,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_indexscan", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of index-scan plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_indexscan,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_indexonlyscan", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of index-only-scan plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_indexonlyscan,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_bitmapscan", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of bitmap-scan plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_bitmapscan,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_tidscan", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of TID scan plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_tidscan,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_sort", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of explicit sort steps."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_sort,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_incremental_sort", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of incremental sort steps."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_incremental_sort,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_hashagg", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of hashed aggregation plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_hashagg,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_material", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of materialization."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_material,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_memoize", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of memoization."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_memoize,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_nestloop", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of nested-loop join plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_nestloop,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_mergejoin", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of merge join plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_mergejoin,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_hashjoin", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of hash join plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_hashjoin,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_gathermerge", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of gather merge plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_gathermerge,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_partitionwise_join", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables partitionwise join."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_partitionwise_join,
- false,
- NULL, NULL, NULL
- },
- {
- {"enable_partitionwise_aggregate", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables partitionwise aggregation and grouping."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_partitionwise_aggregate,
- false,
- NULL, NULL, NULL
- },
- {
- {"enable_parallel_append", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of parallel append plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_parallel_append,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_parallel_hash", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of parallel hash plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_parallel_hash,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_partition_pruning", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables plan-time and execution-time partition pruning."),
- gettext_noop("Allows the query planner and executor to compare partition "
- "bounds to conditions in the query to determine which "
- "partitions must be scanned."),
- GUC_EXPLAIN
- },
- &enable_partition_pruning,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_presorted_aggregate", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's ability to produce plans that "
- "provide presorted input for ORDER BY / DISTINCT aggregate "
- "functions."),
- gettext_noop("Allows the query planner to build plans that provide "
- "presorted input for aggregate functions with an ORDER BY / "
- "DISTINCT clause. When disabled, implicit sorts are always "
- "performed during execution."),
- GUC_EXPLAIN
- },
- &enable_presorted_aggregate,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_async_append", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables the planner's use of async append plans."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_async_append,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_self_join_elimination", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables removal of unique self-joins."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_self_join_elimination,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_group_by_reordering", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables reordering of GROUP BY keys."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_group_by_reordering,
- true,
- NULL, NULL, NULL
- },
- {
- {"enable_distinct_reordering", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables reordering of DISTINCT keys."),
- NULL,
- GUC_EXPLAIN
- },
- &enable_distinct_reordering,
- true,
- NULL, NULL, NULL
- },
- {
- {"geqo", PGC_USERSET, QUERY_TUNING_GEQO,
- gettext_noop("Enables genetic query optimization."),
- gettext_noop("This algorithm attempts to do planning without "
- "exhaustive searching."),
- GUC_EXPLAIN
- },
- &enable_geqo,
- true,
- NULL, NULL, NULL
- },
- {
- /*
- * Not for general use --- used by SET SESSION AUTHORIZATION and SET
- * ROLE
- */
- {"is_superuser", PGC_INTERNAL, UNGROUPED,
- gettext_noop("Shows whether the current user is a superuser."),
- NULL,
- GUC_REPORT | GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_ALLOW_IN_PARALLEL
- },
- ¤t_role_is_superuser,
- false,
- NULL, NULL, NULL
- },
- {
- /*
- * This setting itself cannot be set by ALTER SYSTEM to avoid an
- * operator turning this setting off by using ALTER SYSTEM, without a
- * way to turn it back on.
- */
- {"allow_alter_system", PGC_SIGHUP, COMPAT_OPTIONS_OTHER,
- gettext_noop("Allows running the ALTER SYSTEM command."),
- gettext_noop("Can be set to off for environments where global configuration "
- "changes should be made using a different method."),
- GUC_DISALLOW_IN_AUTO_FILE
- },
- &AllowAlterSystem,
- true,
- NULL, NULL, NULL
- },
- {
- {"bonjour", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
- gettext_noop("Enables advertising the server via Bonjour."),
- NULL
- },
- &enable_bonjour,
- false,
- check_bonjour, NULL, NULL
- },
- {
- {"track_commit_timestamp", PGC_POSTMASTER, REPLICATION_SENDING,
- gettext_noop("Collects transaction commit time."),
- NULL
- },
- &track_commit_timestamp,
- false,
- NULL, NULL, NULL
- },
- {
- {"ssl", PGC_SIGHUP, CONN_AUTH_SSL,
- gettext_noop("Enables SSL connections."),
- NULL
- },
- &EnableSSL,
- false,
- check_ssl, NULL, NULL
- },
- {
- {"ssl_passphrase_command_supports_reload", PGC_SIGHUP, CONN_AUTH_SSL,
- gettext_noop("Controls whether \"ssl_passphrase_command\" is called during server reload."),
- NULL
- },
- &ssl_passphrase_command_supports_reload,
- false,
- NULL, NULL, NULL
- },
- {
- {"ssl_prefer_server_ciphers", PGC_SIGHUP, CONN_AUTH_SSL,
- gettext_noop("Give priority to server ciphersuite order."),
- NULL
- },
- &SSLPreferServerCiphers,
- true,
- NULL, NULL, NULL
- },
- {
- {"fsync", PGC_SIGHUP, WAL_SETTINGS,
- gettext_noop("Forces synchronization of updates to disk."),
- gettext_noop("The server will use the fsync() system call in several places to make "
- "sure that updates are physically written to disk. This ensures "
- "that a database cluster will recover to a consistent state after "
- "an operating system or hardware crash.")
- },
- &enableFsync,
- true,
- NULL, NULL, NULL
- },
- {
- {"ignore_checksum_failure", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Continues processing after a checksum failure."),
- gettext_noop("Detection of a checksum failure normally causes PostgreSQL to "
- "report an error, aborting the current transaction. Setting "
- "ignore_checksum_failure to true causes the system to ignore the failure "
- "(but still report a warning), and continue processing. This "
- "behavior could cause crashes or other serious problems. Only "
- "has an effect if checksums are enabled."),
- GUC_NOT_IN_SAMPLE
- },
- &ignore_checksum_failure,
- false,
- NULL, NULL, NULL
- },
- {
- {"zero_damaged_pages", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Continues processing past damaged page headers."),
- gettext_noop("Detection of a damaged page header normally causes PostgreSQL to "
- "report an error, aborting the current transaction. Setting "
- "\"zero_damaged_pages\" to true causes the system to instead report a "
- "warning, zero out the damaged page, and continue processing. This "
- "behavior will destroy data, namely all the rows on the damaged page."),
- GUC_NOT_IN_SAMPLE
- },
- &zero_damaged_pages,
- false,
- NULL, NULL, NULL
- },
- {
- {"ignore_invalid_pages", PGC_POSTMASTER, DEVELOPER_OPTIONS,
- gettext_noop("Continues recovery after an invalid pages failure."),
- gettext_noop("Detection of WAL records having references to "
- "invalid pages during recovery causes PostgreSQL to "
- "raise a PANIC-level error, aborting the recovery. "
- "Setting \"ignore_invalid_pages\" to true causes "
- "the system to ignore invalid page references "
- "in WAL records (but still report a warning), "
- "and continue recovery. This behavior may cause "
- "crashes, data loss, propagate or hide corruption, "
- "or other serious problems. Only has an effect "
- "during recovery or in standby mode."),
- GUC_NOT_IN_SAMPLE
- },
- &ignore_invalid_pages,
- false,
- NULL, NULL, NULL
- },
- {
- {"full_page_writes", PGC_SIGHUP, WAL_SETTINGS,
- gettext_noop("Writes full pages to WAL when first modified after a checkpoint."),
- gettext_noop("A page write in process during an operating system crash might be "
- "only partially written to disk. During recovery, the row changes "
- "stored in WAL are not enough to recover. This option writes "
- "pages when first modified after a checkpoint to WAL so full recovery "
- "is possible.")
- },
- &fullPageWrites,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"wal_log_hints", PGC_POSTMASTER, WAL_SETTINGS,
- gettext_noop("Writes full pages to WAL when first modified after a checkpoint, even for a non-critical modification."),
- NULL
- },
- &wal_log_hints,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"wal_init_zero", PGC_SUSET, WAL_SETTINGS,
- gettext_noop("Writes zeroes to new WAL files before first use."),
- NULL
- },
- &wal_init_zero,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"wal_recycle", PGC_SUSET, WAL_SETTINGS,
- gettext_noop("Recycles WAL files by renaming them."),
- NULL
- },
- &wal_recycle,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"log_checkpoints", PGC_SIGHUP, LOGGING_WHAT,
- gettext_noop("Logs each checkpoint."),
- NULL
- },
- &log_checkpoints,
- true,
- NULL, NULL, NULL
- },
- {
- {"trace_connection_negotiation", PGC_POSTMASTER, DEVELOPER_OPTIONS,
- gettext_noop("Logs details of pre-authentication connection handshake."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &Trace_connection_negotiation,
- false,
- NULL, NULL, NULL
- },
- {
- {"log_disconnections", PGC_SU_BACKEND, LOGGING_WHAT,
- gettext_noop("Logs end of a session, including duration."),
- NULL
- },
- &Log_disconnections,
- false,
- NULL, NULL, NULL
- },
- {
- {"log_replication_commands", PGC_SUSET, LOGGING_WHAT,
- gettext_noop("Logs each replication command."),
- NULL
- },
- &log_replication_commands,
- false,
- NULL, NULL, NULL
- },
- {
- {"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
- },
- &assert_enabled,
- DEFAULT_ASSERT_ENABLED,
- NULL, NULL, NULL
- },
-
- {
- {"exit_on_error", PGC_USERSET, ERROR_HANDLING_OPTIONS,
- gettext_noop("Terminate session on any error."),
- NULL
- },
- &ExitOnAnyError,
- false,
- NULL, NULL, NULL
- },
- {
- {"restart_after_crash", PGC_SIGHUP, ERROR_HANDLING_OPTIONS,
- gettext_noop("Reinitialize server after backend crash."),
- NULL
- },
- &restart_after_crash,
- true,
- NULL, NULL, NULL
- },
- {
- {"remove_temp_files_after_crash", PGC_SIGHUP, DEVELOPER_OPTIONS,
- gettext_noop("Remove temporary files after backend crash."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &remove_temp_files_after_crash,
- true,
- NULL, NULL, NULL
- },
- {
- {"send_abort_for_crash", PGC_SIGHUP, DEVELOPER_OPTIONS,
- gettext_noop("Send SIGABRT not SIGQUIT to child processes after backend crash."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &send_abort_for_crash,
- false,
- NULL, NULL, NULL
- },
- {
- {"send_abort_for_kill", PGC_SIGHUP, DEVELOPER_OPTIONS,
- gettext_noop("Send SIGABRT not SIGKILL to stuck child processes."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &send_abort_for_kill,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"log_duration", PGC_SUSET, LOGGING_WHAT,
- gettext_noop("Logs the duration of each completed SQL statement."),
- NULL
- },
- &log_duration,
- false,
- NULL, NULL, NULL
- },
-#ifdef DEBUG_NODE_TESTS_ENABLED
- {
- {"debug_copy_parse_plan_trees", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Set this to force all parse and plan trees to be passed through "
- "copyObject(), to facilitate catching errors and omissions in "
- "copyObject()."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &Debug_copy_parse_plan_trees,
-/* support for legacy compile-time setting */
-#ifdef COPY_PARSE_PLAN_TREES
- true,
-#else
- false,
-#endif
- NULL, NULL, NULL
- },
- {
- {"debug_write_read_parse_plan_trees", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Set this to force all parse and plan trees to be passed through "
- "outfuncs.c/readfuncs.c, to facilitate catching errors and omissions in "
- "those modules."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &Debug_write_read_parse_plan_trees,
-/* support for legacy compile-time setting */
-#ifdef WRITE_READ_PARSE_PLAN_TREES
- true,
-#else
- false,
-#endif
- NULL, NULL, NULL
- },
- {
- {"debug_raw_expression_coverage_test", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Set this to force all raw parse trees for DML statements to be scanned "
- "by raw_expression_tree_walker(), to facilitate catching errors and "
- "omissions in that function."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &Debug_raw_expression_coverage_test,
-/* support for legacy compile-time setting */
-#ifdef RAW_EXPRESSION_COVERAGE_TEST
- true,
-#else
- false,
-#endif
- NULL, NULL, NULL
- },
-#endif /* DEBUG_NODE_TESTS_ENABLED */
- {
- {"debug_print_parse", PGC_USERSET, LOGGING_WHAT,
- gettext_noop("Logs each query's parse tree."),
- NULL
- },
- &Debug_print_parse,
- false,
- NULL, NULL, NULL
- },
- {
- {"debug_print_rewritten", PGC_USERSET, LOGGING_WHAT,
- gettext_noop("Logs each query's rewritten parse tree."),
- NULL
- },
- &Debug_print_rewritten,
- false,
- NULL, NULL, NULL
- },
- {
- {"debug_print_plan", PGC_USERSET, LOGGING_WHAT,
- gettext_noop("Logs each query's execution plan."),
- NULL
- },
- &Debug_print_plan,
- false,
- NULL, NULL, NULL
- },
- {
- {"debug_pretty_print", PGC_USERSET, LOGGING_WHAT,
- gettext_noop("Indents parse and plan tree displays."),
- NULL
- },
- &Debug_pretty_print,
- true,
- NULL, NULL, NULL
- },
- {
- {"log_parser_stats", PGC_SUSET, STATS_MONITORING,
- gettext_noop("Writes parser performance statistics to the server log."),
- NULL
- },
- &log_parser_stats,
- false,
- check_stage_log_stats, NULL, NULL
- },
- {
- {"log_planner_stats", PGC_SUSET, STATS_MONITORING,
- gettext_noop("Writes planner performance statistics to the server log."),
- NULL
- },
- &log_planner_stats,
- false,
- check_stage_log_stats, NULL, NULL
- },
- {
- {"log_executor_stats", PGC_SUSET, STATS_MONITORING,
- gettext_noop("Writes executor performance statistics to the server log."),
- NULL
- },
- &log_executor_stats,
- false,
- check_stage_log_stats, NULL, NULL
- },
- {
- {"log_statement_stats", PGC_SUSET, STATS_MONITORING,
- gettext_noop("Writes cumulative performance statistics to the server log."),
- NULL
- },
- &log_statement_stats,
- false,
- check_log_stats, NULL, NULL
- },
-#ifdef BTREE_BUILD_STATS
- {
- {"log_btree_build_stats", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Logs system resource usage statistics (memory and CPU) on various B-tree operations."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &log_btree_build_stats,
- false,
- NULL, NULL, NULL
- },
-#endif
-
- {
- {"track_activities", PGC_SUSET, STATS_CUMULATIVE,
- gettext_noop("Collects information about executing commands."),
- gettext_noop("Enables the collection of information on the currently "
- "executing command of each session, along with "
- "the time at which that command began execution.")
- },
- &pgstat_track_activities,
- true,
- NULL, NULL, NULL
- },
- {
- {"track_counts", PGC_SUSET, STATS_CUMULATIVE,
- gettext_noop("Collects statistics on database activity."),
- NULL
- },
- &pgstat_track_counts,
- true,
- NULL, NULL, NULL
- },
- {
- {"track_cost_delay_timing", PGC_SUSET, STATS_CUMULATIVE,
- gettext_noop("Collects timing statistics for cost-based vacuum delay."),
- NULL
- },
- &track_cost_delay_timing,
- false,
- NULL, NULL, NULL
- },
- {
- {"track_io_timing", PGC_SUSET, STATS_CUMULATIVE,
- gettext_noop("Collects timing statistics for database I/O activity."),
- NULL
- },
- &track_io_timing,
- false,
- NULL, NULL, NULL
- },
- {
- {"track_wal_io_timing", PGC_SUSET, STATS_CUMULATIVE,
- gettext_noop("Collects timing statistics for WAL I/O activity."),
- NULL
- },
- &track_wal_io_timing,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"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.")
- },
- &update_process_title,
- DEFAULT_UPDATE_PROCESS_TITLE,
- NULL, NULL, NULL
- },
-
- {
- {"autovacuum", PGC_SIGHUP, VACUUM_AUTOVACUUM,
- gettext_noop("Starts the autovacuum subprocess."),
- NULL
- },
- &autovacuum_start_daemon,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"trace_notify", PGC_USERSET, DEVELOPER_OPTIONS,
- gettext_noop("Generates debugging output for LISTEN and NOTIFY."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &Trace_notify,
- false,
- NULL, NULL, NULL
- },
-
-#ifdef LOCK_DEBUG
- {
- {"trace_locks", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Emits information about lock usage."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &Trace_locks,
- false,
- NULL, NULL, NULL
- },
- {
- {"trace_userlocks", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Emits information about user lock usage."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &Trace_userlocks,
- false,
- NULL, NULL, NULL
- },
- {
- {"trace_lwlocks", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Emits information about lightweight lock usage."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &Trace_lwlocks,
- false,
- NULL, NULL, NULL
- },
- {
- {"debug_deadlocks", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Dumps information about all current locks when a deadlock timeout occurs."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &Debug_deadlocks,
- false,
- NULL, NULL, NULL
- },
-#endif
-
- {
- {"log_lock_waits", PGC_SUSET, LOGGING_WHAT,
- gettext_noop("Logs long lock waits."),
- NULL
- },
- &log_lock_waits,
- false,
- NULL, NULL, NULL
- },
- {
- {"log_lock_failures", PGC_SUSET, LOGGING_WHAT,
- gettext_noop("Logs lock failures."),
- NULL
- },
- &log_lock_failures,
- false,
- NULL, NULL, NULL
- },
- {
- {"log_recovery_conflict_waits", PGC_SIGHUP, LOGGING_WHAT,
- gettext_noop("Logs standby recovery conflict waits."),
- NULL
- },
- &log_recovery_conflict_waits,
- false,
- NULL, NULL, NULL
- },
- {
- {"log_hostname", PGC_SIGHUP, LOGGING_WHAT,
- gettext_noop("Logs the host name in the connection logs."),
- gettext_noop("By default, connection logs only show the IP address "
- "of the connecting host. If you want them to show the host name you "
- "can turn this on, but depending on your host name resolution "
- "setup it might impose a non-negligible performance penalty.")
- },
- &log_hostname,
- false,
- NULL, NULL, NULL
- },
- {
- {"transform_null_equals", PGC_USERSET, COMPAT_OPTIONS_OTHER,
- gettext_noop("Treats \"expr=NULL\" as \"expr IS NULL\"."),
- gettext_noop("When turned on, expressions of the form expr = NULL "
- "(or NULL = expr) are treated as expr IS NULL, that is, they "
- "return true if expr evaluates to the null value, and false "
- "otherwise. The correct behavior of expr = NULL is to always "
- "return null (unknown).")
- },
- &Transform_null_equals,
- false,
- NULL, NULL, NULL
- },
- {
- {"default_transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT,
- gettext_noop("Sets the default read-only status of new transactions."),
- NULL,
- GUC_REPORT
- },
- &DefaultXactReadOnly,
- false,
- NULL, NULL, NULL
- },
- {
- {"transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT,
- gettext_noop("Sets the current transaction's read-only status."),
- NULL,
- GUC_NO_RESET | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
- },
- &XactReadOnly,
- false,
- check_transaction_read_only, NULL, NULL
- },
- {
- {"default_transaction_deferrable", PGC_USERSET, CLIENT_CONN_STATEMENT,
- gettext_noop("Sets the default deferrable status of new transactions."),
- NULL
- },
- &DefaultXactDeferrable,
- false,
- NULL, NULL, NULL
- },
- {
- {"transaction_deferrable", PGC_USERSET, CLIENT_CONN_STATEMENT,
- gettext_noop("Whether to defer a read-only serializable transaction until it can be executed with no possible serialization failures."),
- NULL,
- GUC_NO_RESET | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
- },
- &XactDeferrable,
- false,
- check_transaction_deferrable, NULL, NULL
- },
- {
- {"row_security", PGC_USERSET, CLIENT_CONN_STATEMENT,
- gettext_noop("Enables row security."),
- gettext_noop("When enabled, row security will be applied to all users.")
- },
- &row_security,
- true,
- NULL, NULL, NULL
- },
- {
- {"check_function_bodies", PGC_USERSET, CLIENT_CONN_STATEMENT,
- gettext_noop("Check routine bodies during CREATE FUNCTION and CREATE PROCEDURE."),
- NULL
- },
- &check_function_bodies,
- true,
- NULL, NULL, NULL
- },
- {
- {"array_nulls", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
- gettext_noop("Enables input of NULL elements in arrays."),
- gettext_noop("When turned on, unquoted NULL in an array input "
- "value means a null value; "
- "otherwise it is taken literally.")
- },
- &Array_nulls,
- true,
- NULL, NULL, NULL
- },
-
- /*
- * WITH OIDS support, and consequently default_with_oids, was removed in
- * PostgreSQL 12, but we tolerate the parameter being set to false to
- * avoid unnecessarily breaking older dump files.
- */
- {
- {"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
- gettext_noop("WITH OIDS is no longer supported; this can only be false."),
- NULL,
- GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
- },
- &default_with_oids,
- false,
- check_default_with_oids, NULL, NULL
- },
- {
- {"logging_collector", PGC_POSTMASTER, LOGGING_WHERE,
- gettext_noop("Start a subprocess to capture stderr, csvlog and/or jsonlog into log files."),
- NULL
- },
- &Logging_collector,
- false,
- NULL, NULL, NULL
- },
- {
- {"log_truncate_on_rotation", PGC_SIGHUP, LOGGING_WHERE,
- gettext_noop("Truncate existing log files of same name during log rotation."),
- NULL
- },
- &Log_truncate_on_rotation,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"trace_sort", PGC_USERSET, DEVELOPER_OPTIONS,
- gettext_noop("Emit information about resource usage in sorting."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &trace_sort,
- false,
- NULL, NULL, NULL
- },
-
-#ifdef TRACE_SYNCSCAN
- /* this is undocumented because not exposed in a standard build */
{
- {"trace_syncscan", PGC_USERSET, DEVELOPER_OPTIONS,
- gettext_noop("Generate debugging output for synchronized scanning."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &trace_syncscan,
- false,
- NULL, NULL, NULL
- },
+ {{"enable_seqscan", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of sequential-scan plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_seqscan,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_indexscan", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of index-scan plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_indexscan,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_indexonlyscan", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of index-only-scan plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_indexonlyscan,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_bitmapscan", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of bitmap-scan plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_bitmapscan,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_tidscan", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of TID scan plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_tidscan,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_sort", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of explicit sort steps."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_sort,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_incremental_sort", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of incremental sort steps."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_incremental_sort,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_hashagg", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of hashed aggregation plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_hashagg,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_material", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of materialization."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_material,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_memoize", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of memoization."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_memoize,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_nestloop", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of nested-loop join plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_nestloop,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_mergejoin", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of merge join plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_mergejoin,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_hashjoin", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of hash join plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_hashjoin,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_gathermerge", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of gather merge plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_gathermerge,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_partitionwise_join", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables partitionwise join."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_partitionwise_join,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_partitionwise_aggregate", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables partitionwise aggregation and grouping."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_partitionwise_aggregate,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_parallel_append", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of parallel append plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_parallel_append,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_parallel_hash", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of parallel hash plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_parallel_hash,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_partition_pruning", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables plan-time and execution-time partition pruning."),
+ gettext_noop("Allows the query planner and executor to compare partition "
+ "bounds to conditions in the query to determine which "
+ "partitions must be scanned."),
+ GUC_EXPLAIN},
+ &enable_partition_pruning,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_presorted_aggregate", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's ability to produce plans that "
+ "provide presorted input for ORDER BY / DISTINCT aggregate "
+ "functions."),
+ gettext_noop("Allows the query planner to build plans that provide "
+ "presorted input for aggregate functions with an ORDER BY / "
+ "DISTINCT clause. When disabled, implicit sorts are always "
+ "performed during execution."),
+ GUC_EXPLAIN},
+ &enable_presorted_aggregate,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_async_append", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables the planner's use of async append plans."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_async_append,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_self_join_elimination", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables removal of unique self-joins."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_self_join_elimination,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_group_by_reordering", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables reordering of GROUP BY keys."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_group_by_reordering,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"enable_distinct_reordering", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables reordering of DISTINCT keys."),
+ NULL,
+ GUC_EXPLAIN},
+ &enable_distinct_reordering,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"geqo", PGC_USERSET, QUERY_TUNING_GEQO,
+ gettext_noop("Enables genetic query optimization."),
+ gettext_noop("This algorithm attempts to do planning without "
+ "exhaustive searching."),
+ GUC_EXPLAIN},
+ &enable_geqo,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {/*
+ * Not for general use --- used by SET SESSION AUTHORIZATION and SET
+ * ROLE
+ */
+ {"is_superuser", PGC_INTERNAL, UNGROUPED,
+ gettext_noop("Shows whether the current user is a superuser."),
+ NULL,
+ GUC_REPORT | GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_ALLOW_IN_PARALLEL},
+ ¤t_role_is_superuser,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {/*
+ * This setting itself cannot be set by ALTER SYSTEM to avoid an
+ * operator turning this setting off by using ALTER SYSTEM, without a
+ * way to turn it back on.
+ */
+ {"allow_alter_system", PGC_SIGHUP, COMPAT_OPTIONS_OTHER,
+ gettext_noop("Allows running the ALTER SYSTEM command."),
+ gettext_noop("Can be set to off for environments where global configuration "
+ "changes should be made using a different method."),
+ GUC_DISALLOW_IN_AUTO_FILE},
+ &AllowAlterSystem,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"bonjour", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
+ gettext_noop("Enables advertising the server via Bonjour."),
+ NULL},
+ &enable_bonjour,
+ false,
+ check_bonjour,
+ NULL,
+ NULL},
+ {{"track_commit_timestamp", PGC_POSTMASTER, REPLICATION_SENDING,
+ gettext_noop("Collects transaction commit time."),
+ NULL},
+ &track_commit_timestamp,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"ssl", PGC_SIGHUP, CONN_AUTH_SSL,
+ gettext_noop("Enables SSL connections."),
+ NULL},
+ &EnableSSL,
+ false,
+ check_ssl,
+ NULL,
+ NULL},
+ {{"ssl_passphrase_command_supports_reload", PGC_SIGHUP, CONN_AUTH_SSL,
+ gettext_noop("Controls whether \"ssl_passphrase_command\" is called during server reload."),
+ NULL},
+ &ssl_passphrase_command_supports_reload,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"ssl_prefer_server_ciphers", PGC_SIGHUP, CONN_AUTH_SSL,
+ gettext_noop("Give priority to server ciphersuite order."),
+ NULL},
+ &SSLPreferServerCiphers,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"fsync", PGC_SIGHUP, WAL_SETTINGS,
+ gettext_noop("Forces synchronization of updates to disk."),
+ gettext_noop("The server will use the fsync() system call in several places to make "
+ "sure that updates are physically written to disk. This ensures "
+ "that a database cluster will recover to a consistent state after "
+ "an operating system or hardware crash.")},
+ &enableFsync,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"ignore_checksum_failure", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Continues processing after a checksum failure."),
+ gettext_noop("Detection of a checksum failure normally causes PostgreSQL to "
+ "report an error, aborting the current transaction. Setting "
+ "ignore_checksum_failure to true causes the system to ignore the failure "
+ "(but still report a warning), and continue processing. This "
+ "behavior could cause crashes or other serious problems. Only "
+ "has an effect if checksums are enabled."),
+ GUC_NOT_IN_SAMPLE},
+ &ignore_checksum_failure,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"zero_damaged_pages", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Continues processing past damaged page headers."),
+ gettext_noop("Detection of a damaged page header normally causes PostgreSQL to "
+ "report an error, aborting the current transaction. Setting "
+ "\"zero_damaged_pages\" to true causes the system to instead report a "
+ "warning, zero out the damaged page, and continue processing. This "
+ "behavior will destroy data, namely all the rows on the damaged page."),
+ GUC_NOT_IN_SAMPLE},
+ &zero_damaged_pages,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"ignore_invalid_pages", PGC_POSTMASTER, DEVELOPER_OPTIONS,
+ gettext_noop("Continues recovery after an invalid pages failure."),
+ gettext_noop("Detection of WAL records having references to "
+ "invalid pages during recovery causes PostgreSQL to "
+ "raise a PANIC-level error, aborting the recovery. "
+ "Setting \"ignore_invalid_pages\" to true causes "
+ "the system to ignore invalid page references "
+ "in WAL records (but still report a warning), "
+ "and continue recovery. This behavior may cause "
+ "crashes, data loss, propagate or hide corruption, "
+ "or other serious problems. Only has an effect "
+ "during recovery or in standby mode."),
+ GUC_NOT_IN_SAMPLE},
+ &ignore_invalid_pages,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"full_page_writes", PGC_SIGHUP, WAL_SETTINGS,
+ gettext_noop("Writes full pages to WAL when first modified after a checkpoint."),
+ gettext_noop("A page write in process during an operating system crash might be "
+ "only partially written to disk. During recovery, the row changes "
+ "stored in WAL are not enough to recover. This option writes "
+ "pages when first modified after a checkpoint to WAL so full recovery "
+ "is possible.")},
+ &fullPageWrites,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"wal_log_hints", PGC_POSTMASTER, WAL_SETTINGS,
+ gettext_noop("Writes full pages to WAL when first modified after a checkpoint, even for a non-critical modification."),
+ NULL},
+ &wal_log_hints,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"wal_init_zero", PGC_SUSET, WAL_SETTINGS,
+ gettext_noop("Writes zeroes to new WAL files before first use."),
+ NULL},
+ &wal_init_zero,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"wal_recycle", PGC_SUSET, WAL_SETTINGS,
+ gettext_noop("Recycles WAL files by renaming them."),
+ NULL},
+ &wal_recycle,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"log_checkpoints", PGC_SIGHUP, LOGGING_WHAT,
+ gettext_noop("Logs each checkpoint."),
+ NULL},
+ &log_checkpoints,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"trace_connection_negotiation", PGC_POSTMASTER, DEVELOPER_OPTIONS,
+ gettext_noop("Logs details of pre-authentication connection handshake."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &Trace_connection_negotiation,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"log_disconnections", PGC_SU_BACKEND, LOGGING_WHAT,
+ gettext_noop("Logs end of a session, including duration."),
+ NULL},
+ &Log_disconnections,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"log_replication_commands", PGC_SUSET, LOGGING_WHAT,
+ gettext_noop("Logs each replication command."),
+ NULL},
+ &log_replication_commands,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"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},
+ &assert_enabled,
+ DEFAULT_ASSERT_ENABLED,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"exit_on_error", PGC_USERSET, ERROR_HANDLING_OPTIONS,
+ gettext_noop("Terminate session on any error."),
+ NULL},
+ &ExitOnAnyError,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"restart_after_crash", PGC_SIGHUP, ERROR_HANDLING_OPTIONS,
+ gettext_noop("Reinitialize server after backend crash."),
+ NULL},
+ &restart_after_crash,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"remove_temp_files_after_crash", PGC_SIGHUP, DEVELOPER_OPTIONS,
+ gettext_noop("Remove temporary files after backend crash."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &remove_temp_files_after_crash,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"send_abort_for_crash", PGC_SIGHUP, DEVELOPER_OPTIONS,
+ gettext_noop("Send SIGABRT not SIGQUIT to child processes after backend crash."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &send_abort_for_crash,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"send_abort_for_kill", PGC_SIGHUP, DEVELOPER_OPTIONS,
+ gettext_noop("Send SIGABRT not SIGKILL to stuck child processes."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &send_abort_for_kill,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"log_duration", PGC_SUSET, LOGGING_WHAT,
+ gettext_noop("Logs the duration of each completed SQL statement."),
+ NULL},
+ &log_duration,
+ false,
+ NULL,
+ NULL,
+ NULL},
+#ifdef DEBUG_NODE_TESTS_ENABLED
+ {{"debug_copy_parse_plan_trees", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Set this to force all parse and plan trees to be passed through "
+ "copyObject(), to facilitate catching errors and omissions in "
+ "copyObject()."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &Debug_copy_parse_plan_trees,
+/* support for legacy compile-time setting */
+#ifdef COPY_PARSE_PLAN_TREES
+ true,
+#else
+ false,
#endif
-
-#ifdef DEBUG_BOUNDED_SORT
- /* this is undocumented because not exposed in a standard build */
- {
- {
- "optimize_bounded_sort", PGC_USERSET, QUERY_TUNING_METHOD,
- gettext_noop("Enables bounded sorting using heap sort."),
- NULL,
- GUC_NOT_IN_SAMPLE | GUC_EXPLAIN
- },
- &optimize_bounded_sort,
- true,
- NULL, NULL, NULL
- },
+ NULL,
+ NULL,
+ NULL},
+ {{"debug_write_read_parse_plan_trees", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Set this to force all parse and plan trees to be passed through "
+ "outfuncs.c/readfuncs.c, to facilitate catching errors and omissions in "
+ "those modules."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &Debug_write_read_parse_plan_trees,
+/* support for legacy compile-time setting */
+#ifdef WRITE_READ_PARSE_PLAN_TREES
+ true,
+#else
+ false,
#endif
-
-#ifdef WAL_DEBUG
- {
- {"wal_debug", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Emit WAL-related debugging output."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &XLOG_DEBUG,
- false,
- NULL, NULL, NULL
- },
+ NULL,
+ NULL,
+ NULL},
+ {{"debug_raw_expression_coverage_test", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Set this to force all raw parse trees for DML statements to be scanned "
+ "by raw_expression_tree_walker(), to facilitate catching errors and "
+ "omissions in that function."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &Debug_raw_expression_coverage_test,
+/* support for legacy compile-time setting */
+#ifdef RAW_EXPRESSION_COVERAGE_TEST
+ true,
+#else
+ false,
+#endif
+ NULL,
+ NULL,
+ NULL},
+#endif /* DEBUG_NODE_TESTS_ENABLED */
+ {{"debug_print_raw_parse", PGC_USERSET, LOGGING_WHAT,
+ gettext_noop("Logs each query's raw parse tree."),
+ NULL},
+ &Debug_print_raw_parse,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"debug_print_parse", PGC_USERSET, LOGGING_WHAT,
+ gettext_noop("Logs each query's parse tree."),
+ NULL},
+ &Debug_print_parse,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"debug_print_rewritten", PGC_USERSET, LOGGING_WHAT,
+ gettext_noop("Logs each query's rewritten parse tree."),
+ NULL},
+ &Debug_print_rewritten,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"debug_print_plan", PGC_USERSET, LOGGING_WHAT,
+ gettext_noop("Logs each query's execution plan."),
+ NULL},
+ &Debug_print_plan,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"debug_pretty_print", PGC_USERSET, LOGGING_WHAT,
+ gettext_noop("Indents parse and plan tree displays."),
+ NULL},
+ &Debug_pretty_print,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"log_parser_stats", PGC_SUSET, STATS_MONITORING,
+ gettext_noop("Writes parser performance statistics to the server log."),
+ NULL},
+ &log_parser_stats,
+ false,
+ check_stage_log_stats,
+ NULL,
+ NULL},
+ {{"log_planner_stats", PGC_SUSET, STATS_MONITORING,
+ gettext_noop("Writes planner performance statistics to the server log."),
+ NULL},
+ &log_planner_stats,
+ false,
+ check_stage_log_stats,
+ NULL,
+ NULL},
+ {{"log_executor_stats", PGC_SUSET, STATS_MONITORING,
+ gettext_noop("Writes executor performance statistics to the server log."),
+ NULL},
+ &log_executor_stats,
+ false,
+ check_stage_log_stats,
+ NULL,
+ NULL},
+ {{"log_statement_stats", PGC_SUSET, STATS_MONITORING,
+ gettext_noop("Writes cumulative performance statistics to the server log."),
+ NULL},
+ &log_statement_stats,
+ false,
+ check_log_stats,
+ NULL,
+ NULL},
+#ifdef BTREE_BUILD_STATS
+ {{"log_btree_build_stats", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Logs system resource usage statistics (memory and CPU) on various B-tree operations."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &log_btree_build_stats,
+ false,
+ NULL,
+ NULL,
+ NULL},
#endif
- {
- {"integer_datetimes", PGC_INTERNAL, PRESET_OPTIONS,
- gettext_noop("Shows whether datetimes are integer based."),
- NULL,
- GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
- },
- &integer_datetimes,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"krb_caseins_users", PGC_SIGHUP, CONN_AUTH_AUTH,
- gettext_noop("Sets whether Kerberos and GSSAPI user names should be treated as case-insensitive."),
- NULL
- },
- &pg_krb_caseins_users,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"gss_accept_delegation", PGC_SIGHUP, CONN_AUTH_AUTH,
- gettext_noop("Sets whether GSSAPI delegation should be accepted from the client."),
- NULL
- },
- &pg_gss_accept_delegation,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"escape_string_warning", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
- gettext_noop("Warn about backslash escapes in ordinary string literals."),
- NULL
- },
- &escape_string_warning,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"standard_conforming_strings", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
- gettext_noop("Causes '...' strings to treat backslashes literally."),
- NULL,
- GUC_REPORT
- },
- &standard_conforming_strings,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"synchronize_seqscans", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
- gettext_noop("Enables synchronized sequential scans."),
- NULL
- },
- &synchronize_seqscans,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"recovery_target_inclusive", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
- gettext_noop("Sets whether to include or exclude transaction with recovery target."),
- NULL
- },
- &recoveryTargetInclusive,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"summarize_wal", PGC_SIGHUP, WAL_SUMMARIZATION,
- gettext_noop("Starts the WAL summarizer process to enable incremental backup."),
- NULL
- },
- &summarize_wal,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"hot_standby", PGC_POSTMASTER, REPLICATION_STANDBY,
- gettext_noop("Allows connections and queries during recovery."),
- NULL
- },
- &EnableHotStandby,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"hot_standby_feedback", PGC_SIGHUP, REPLICATION_STANDBY,
- gettext_noop("Allows feedback from a hot standby to the primary that will avoid query conflicts."),
- NULL
- },
- &hot_standby_feedback,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"in_hot_standby", PGC_INTERNAL, PRESET_OPTIONS,
- gettext_noop("Shows whether hot standby is currently active."),
- NULL,
- GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
- },
- &in_hot_standby_guc,
- false,
- NULL, NULL, show_in_hot_standby
- },
-
- {
- {"allow_system_table_mods", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Allows modifications of the structure of system tables."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &allowSystemTableMods,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"ignore_system_indexes", PGC_BACKEND, DEVELOPER_OPTIONS,
- gettext_noop("Disables reading from system indexes."),
- gettext_noop("It does not prevent updating the indexes, so it is safe "
- "to use. The worst consequence is slowness."),
- GUC_NOT_IN_SAMPLE
- },
- &IgnoreSystemIndexes,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"allow_in_place_tablespaces", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Allows tablespaces directly inside pg_tblspc, for testing."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &allow_in_place_tablespaces,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"lo_compat_privileges", PGC_SUSET, COMPAT_OPTIONS_PREVIOUS,
- gettext_noop("Enables backward compatibility mode for privilege checks on large objects."),
- gettext_noop("Skips privilege checks when reading or modifying large objects, "
- "for compatibility with PostgreSQL releases prior to 9.0.")
- },
- &lo_compat_privileges,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"quote_all_identifiers", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
- gettext_noop("When generating SQL fragments, quote all identifiers."),
- NULL,
- },
- "e_all_identifiers,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"data_checksums", PGC_INTERNAL, PRESET_OPTIONS,
- gettext_noop("Shows whether data checksums are turned on for this cluster."),
- NULL,
- GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_RUNTIME_COMPUTED
- },
- &data_checksums,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"syslog_sequence_numbers", PGC_SIGHUP, LOGGING_WHERE,
- gettext_noop("Add sequence number to syslog messages to avoid duplicate suppression."),
- NULL
- },
- &syslog_sequence_numbers,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"syslog_split_messages", PGC_SIGHUP, LOGGING_WHERE,
- gettext_noop("Split messages sent to syslog by lines and to fit into 1024 bytes."),
- NULL
- },
- &syslog_split_messages,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"parallel_leader_participation", PGC_USERSET, RESOURCES_WORKER_PROCESSES,
- gettext_noop("Controls whether Gather and Gather Merge also run subplans."),
- gettext_noop("Should gather nodes also run subplans or just gather tuples?"),
- GUC_EXPLAIN
- },
- ¶llel_leader_participation,
- true,
- NULL, NULL, NULL
- },
+ {{"track_activities", PGC_SUSET, STATS_CUMULATIVE,
+ gettext_noop("Collects information about executing commands."),
+ gettext_noop("Enables the collection of information on the currently "
+ "executing command of each session, along with "
+ "the time at which that command began execution.")},
+ &pgstat_track_activities,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"track_counts", PGC_SUSET, STATS_CUMULATIVE,
+ gettext_noop("Collects statistics on database activity."),
+ NULL},
+ &pgstat_track_counts,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"track_cost_delay_timing", PGC_SUSET, STATS_CUMULATIVE,
+ gettext_noop("Collects timing statistics for cost-based vacuum delay."),
+ NULL},
+ &track_cost_delay_timing,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"track_io_timing", PGC_SUSET, STATS_CUMULATIVE,
+ gettext_noop("Collects timing statistics for database I/O activity."),
+ NULL},
+ &track_io_timing,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"track_wal_io_timing", PGC_SUSET, STATS_CUMULATIVE,
+ gettext_noop("Collects timing statistics for WAL I/O activity."),
+ NULL},
+ &track_wal_io_timing,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"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.")},
+ &update_process_title,
+ DEFAULT_UPDATE_PROCESS_TITLE,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"autovacuum", PGC_SIGHUP, VACUUM_AUTOVACUUM,
+ gettext_noop("Starts the autovacuum subprocess."),
+ NULL},
+ &autovacuum_start_daemon,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"trace_notify", PGC_USERSET, DEVELOPER_OPTIONS,
+ gettext_noop("Generates debugging output for LISTEN and NOTIFY."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &Trace_notify,
+ false,
+ NULL,
+ NULL,
+ NULL},
- {
- {"jit", PGC_USERSET, QUERY_TUNING_OTHER,
- gettext_noop("Allow JIT compilation."),
- NULL,
- GUC_EXPLAIN
- },
- &jit_enabled,
- true,
- NULL, NULL, NULL
- },
+#ifdef LOCK_DEBUG
+ {{"trace_locks", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Emits information about lock usage."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &Trace_locks,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"trace_userlocks", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Emits information about user lock usage."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &Trace_userlocks,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"trace_lwlocks", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Emits information about lightweight lock usage."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &Trace_lwlocks,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"debug_deadlocks", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Dumps information about all current locks when a deadlock timeout occurs."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &Debug_deadlocks,
+ false,
+ NULL,
+ NULL,
+ NULL},
+#endif
- {
- {"jit_debugging_support", PGC_SU_BACKEND, DEVELOPER_OPTIONS,
- gettext_noop("Register JIT-compiled functions with debugger."),
- NULL,
- GUC_NOT_IN_SAMPLE
- },
- &jit_debugging_support,
- false,
+ {{"log_lock_waits", PGC_SUSET, LOGGING_WHAT,
+ gettext_noop("Logs long lock waits."),
+ NULL},
+ &log_lock_waits,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"log_lock_failures", PGC_SUSET, LOGGING_WHAT,
+ gettext_noop("Logs lock failures."),
+ NULL},
+ &log_lock_failures,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"log_recovery_conflict_waits", PGC_SIGHUP, LOGGING_WHAT,
+ gettext_noop("Logs standby recovery conflict waits."),
+ NULL},
+ &log_recovery_conflict_waits,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"log_hostname", PGC_SIGHUP, LOGGING_WHAT,
+ gettext_noop("Logs the host name in the connection logs."),
+ gettext_noop("By default, connection logs only show the IP address "
+ "of the connecting host. If you want them to show the host name you "
+ "can turn this on, but depending on your host name resolution "
+ "setup it might impose a non-negligible performance penalty.")},
+ &log_hostname,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"transform_null_equals", PGC_USERSET, COMPAT_OPTIONS_OTHER,
+ gettext_noop("Treats \"expr=NULL\" as \"expr IS NULL\"."),
+ gettext_noop("When turned on, expressions of the form expr = NULL "
+ "(or NULL = expr) are treated as expr IS NULL, that is, they "
+ "return true if expr evaluates to the null value, and false "
+ "otherwise. The correct behavior of expr = NULL is to always "
+ "return null (unknown).")},
+ &Transform_null_equals,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"default_transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT,
+ gettext_noop("Sets the default read-only status of new transactions."),
+ NULL,
+ GUC_REPORT},
+ &DefaultXactReadOnly,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT,
+ gettext_noop("Sets the current transaction's read-only status."),
+ NULL,
+ GUC_NO_RESET | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE},
+ &XactReadOnly,
+ false,
+ check_transaction_read_only,
+ NULL,
+ NULL},
+ {{"default_transaction_deferrable", PGC_USERSET, CLIENT_CONN_STATEMENT,
+ gettext_noop("Sets the default deferrable status of new transactions."),
+ NULL},
+ &DefaultXactDeferrable,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"transaction_deferrable", PGC_USERSET, CLIENT_CONN_STATEMENT,
+ gettext_noop("Whether to defer a read-only serializable transaction until it can be executed with no possible serialization failures."),
+ NULL,
+ GUC_NO_RESET | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE},
+ &XactDeferrable,
+ false,
+ check_transaction_deferrable,
+ NULL,
+ NULL},
+ {{"row_security", PGC_USERSET, CLIENT_CONN_STATEMENT,
+ gettext_noop("Enables row security."),
+ gettext_noop("When enabled, row security will be applied to all users.")},
+ &row_security,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"check_function_bodies", PGC_USERSET, CLIENT_CONN_STATEMENT,
+ gettext_noop("Check routine bodies during CREATE FUNCTION and CREATE PROCEDURE."),
+ NULL},
+ &check_function_bodies,
+ true,
+ NULL,
+ NULL,
+ NULL},
+ {{"array_nulls", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
+ gettext_noop("Enables input of NULL elements in arrays."),
+ gettext_noop("When turned on, unquoted NULL in an array input "
+ "value means a null value; "
+ "otherwise it is taken literally.")},
+ &Array_nulls,
+ true,
+ NULL,
+ NULL,
+ NULL},
/*
- * This is not guaranteed to be available, but given it's a developer
- * oriented option, it doesn't seem worth adding code checking
- * availability.
+ * WITH OIDS support, and consequently default_with_oids, was removed in
+ * PostgreSQL 12, but we tolerate the parameter being set to false to
+ * avoid unnecessarily breaking older dump files.
*/
- NULL, NULL, NULL
- },
+ {
+ {"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
+ gettext_noop("WITH OIDS is no longer supported; this can only be false."),
+ NULL,
+ GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE},
+ &default_with_oids,
+ false,
+ check_default_with_oids,
+ NULL,
+ NULL},
+ {{"logging_collector", PGC_POSTMASTER, LOGGING_WHERE,
+ gettext_noop("Start a subprocess to capture stderr, csvlog and/or jsonlog into log files."),
+ NULL},
+ &Logging_collector,
+ false,
+ NULL,
+ NULL,
+ NULL},
+ {{"log_truncate_on_rotation", PGC_SIGHUP, LOGGING_WHERE,
+ gettext_noop("Truncate existing log files of same name during log rotation."),
+ NULL},
+ &Log_truncate_on_rotation,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"trace_sort", PGC_USERSET, DEVELOPER_OPTIONS,
+ gettext_noop("Emit information about resource usage in sorting."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &trace_sort,
+ false,
+ NULL,
+ NULL,
+ NULL},
- {
- {"jit_dump_bitcode", PGC_SUSET, DEVELOPER_OPTIONS,
- gettext_noop("Write out LLVM bitcode to facilitate JIT debugging."),
+#ifdef TRACE_SYNCSCAN
+ /* this is undocumented because not exposed in a standard build */
+ {
+ {"trace_syncscan", PGC_USERSET, DEVELOPER_OPTIONS,
+ gettext_noop("Generate debugging output for synchronized scanning."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &trace_syncscan,
+ false,
NULL,
- GUC_NOT_IN_SAMPLE
- },
- &jit_dump_bitcode,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"jit_expressions", PGC_USERSET, DEVELOPER_OPTIONS,
- gettext_noop("Allow JIT compilation of expressions."),
NULL,
- GUC_NOT_IN_SAMPLE
- },
- &jit_expressions,
- true,
- NULL, NULL, NULL
- },
+ NULL},
+#endif
- {
- {"jit_profiling_support", PGC_SU_BACKEND, DEVELOPER_OPTIONS,
- gettext_noop("Register JIT-compiled functions with perf profiler."),
+#ifdef DEBUG_BOUNDED_SORT
+ /* this is undocumented because not exposed in a standard build */
+ {
+ {"optimize_bounded_sort", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Enables bounded sorting using heap sort."),
+ NULL,
+ GUC_NOT_IN_SAMPLE | GUC_EXPLAIN},
+ &optimize_bounded_sort,
+ true,
NULL,
- GUC_NOT_IN_SAMPLE
- },
- &jit_profiling_support,
- false,
-
- /*
- * This is not guaranteed to be available, but given it's a developer
- * oriented option, it doesn't seem worth adding code checking
- * availability.
- */
- NULL, NULL, NULL
- },
-
- {
- {"jit_tuple_deforming", PGC_USERSET, DEVELOPER_OPTIONS,
- gettext_noop("Allow JIT compilation of tuple deforming."),
NULL,
- GUC_NOT_IN_SAMPLE
- },
- &jit_tuple_deforming,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"data_sync_retry", PGC_POSTMASTER, ERROR_HANDLING_OPTIONS,
- gettext_noop("Whether to continue running after a failure to sync data files."),
- },
- &data_sync_retry,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"wal_receiver_create_temp_slot", PGC_SIGHUP, REPLICATION_STANDBY,
- gettext_noop("Sets whether a WAL receiver should create a temporary replication slot if no permanent slot is configured."),
- },
- &wal_receiver_create_temp_slot,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"event_triggers", PGC_SUSET, CLIENT_CONN_STATEMENT,
- gettext_noop("Enables event triggers."),
- gettext_noop("When enabled, event triggers will fire for all applicable statements."),
- },
- &event_triggers,
- true,
- NULL, NULL, NULL
- },
-
- {
- {"sync_replication_slots", PGC_SIGHUP, REPLICATION_STANDBY,
- gettext_noop("Enables a physical standby to synchronize logical failover replication slots from the primary server."),
- },
- &sync_replication_slots,
- false,
- NULL, NULL, NULL
- },
-
- {
- {"md5_password_warnings", PGC_USERSET, CONN_AUTH_AUTH,
- gettext_noop("Enables deprecation warnings for MD5 passwords."),
- },
- &md5_password_warnings,
- true,
- NULL, NULL, NULL
- },
+ NULL},
+#endif
- {
- {"vacuum_truncate", PGC_USERSET, VACUUM_DEFAULT,
- gettext_noop("Enables vacuum to truncate empty pages at the end of the table."),
- },
- &vacuum_truncate,
- true,
- NULL, NULL, NULL
- },
+#ifdef WAL_DEBUG
+ {{"wal_debug", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Emit WAL-related debugging output."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &XLOG_DEBUG,
+ false,
+ NULL,
+ NULL,
+ NULL},
+#endif
- /* End-of-list marker */
- {
- {NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL, NULL
- }
-};
+ {{"integer_datetimes", PGC_INTERNAL, PRESET_OPTIONS,
+ gettext_noop("Shows whether datetimes are integer based."),
+ NULL,
+ GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE},
+ &integer_datetimes,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"krb_caseins_users", PGC_SIGHUP, CONN_AUTH_AUTH,
+ gettext_noop("Sets whether Kerberos and GSSAPI user names should be treated as case-insensitive."),
+ NULL},
+ &pg_krb_caseins_users,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"gss_accept_delegation", PGC_SIGHUP, CONN_AUTH_AUTH,
+ gettext_noop("Sets whether GSSAPI delegation should be accepted from the client."),
+ NULL},
+ &pg_gss_accept_delegation,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"escape_string_warning", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
+ gettext_noop("Warn about backslash escapes in ordinary string literals."),
+ NULL},
+ &escape_string_warning,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"standard_conforming_strings", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
+ gettext_noop("Causes '...' strings to treat backslashes literally."),
+ NULL,
+ GUC_REPORT},
+ &standard_conforming_strings,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"synchronize_seqscans", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
+ gettext_noop("Enables synchronized sequential scans."),
+ NULL},
+ &synchronize_seqscans,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"recovery_target_inclusive", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
+ gettext_noop("Sets whether to include or exclude transaction with recovery target."),
+ NULL},
+ &recoveryTargetInclusive,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"summarize_wal", PGC_SIGHUP, WAL_SUMMARIZATION,
+ gettext_noop("Starts the WAL summarizer process to enable incremental backup."),
+ NULL},
+ &summarize_wal,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"hot_standby", PGC_POSTMASTER, REPLICATION_STANDBY,
+ gettext_noop("Allows connections and queries during recovery."),
+ NULL},
+ &EnableHotStandby,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"hot_standby_feedback", PGC_SIGHUP, REPLICATION_STANDBY,
+ gettext_noop("Allows feedback from a hot standby to the primary that will avoid query conflicts."),
+ NULL},
+ &hot_standby_feedback,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"in_hot_standby", PGC_INTERNAL, PRESET_OPTIONS,
+ gettext_noop("Shows whether hot standby is currently active."),
+ NULL,
+ GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE},
+ &in_hot_standby_guc,
+ false,
+ NULL,
+ NULL,
+ show_in_hot_standby},
+
+ {{"allow_system_table_mods", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Allows modifications of the structure of system tables."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &allowSystemTableMods,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"ignore_system_indexes", PGC_BACKEND, DEVELOPER_OPTIONS,
+ gettext_noop("Disables reading from system indexes."),
+ gettext_noop("It does not prevent updating the indexes, so it is safe "
+ "to use. The worst consequence is slowness."),
+ GUC_NOT_IN_SAMPLE},
+ &IgnoreSystemIndexes,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"allow_in_place_tablespaces", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Allows tablespaces directly inside pg_tblspc, for testing."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &allow_in_place_tablespaces,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"lo_compat_privileges", PGC_SUSET, COMPAT_OPTIONS_PREVIOUS,
+ gettext_noop("Enables backward compatibility mode for privilege checks on large objects."),
+ gettext_noop("Skips privilege checks when reading or modifying large objects, "
+ "for compatibility with PostgreSQL releases prior to 9.0.")},
+ &lo_compat_privileges,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{
+ "quote_all_identifiers",
+ PGC_USERSET,
+ COMPAT_OPTIONS_PREVIOUS,
+ gettext_noop("When generating SQL fragments, quote all identifiers."),
+ NULL,
+ },
+ "e_all_identifiers,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"data_checksums", PGC_INTERNAL, PRESET_OPTIONS,
+ gettext_noop("Shows whether data checksums are turned on for this cluster."),
+ NULL,
+ GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_RUNTIME_COMPUTED},
+ &data_checksums,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"syslog_sequence_numbers", PGC_SIGHUP, LOGGING_WHERE,
+ gettext_noop("Add sequence number to syslog messages to avoid duplicate suppression."),
+ NULL},
+ &syslog_sequence_numbers,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"syslog_split_messages", PGC_SIGHUP, LOGGING_WHERE,
+ gettext_noop("Split messages sent to syslog by lines and to fit into 1024 bytes."),
+ NULL},
+ &syslog_split_messages,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"parallel_leader_participation", PGC_USERSET, RESOURCES_WORKER_PROCESSES,
+ gettext_noop("Controls whether Gather and Gather Merge also run subplans."),
+ gettext_noop("Should gather nodes also run subplans or just gather tuples?"),
+ GUC_EXPLAIN},
+ ¶llel_leader_participation,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"jit", PGC_USERSET, QUERY_TUNING_OTHER,
+ gettext_noop("Allow JIT compilation."),
+ NULL,
+ GUC_EXPLAIN},
+ &jit_enabled,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"jit_debugging_support", PGC_SU_BACKEND, DEVELOPER_OPTIONS,
+ gettext_noop("Register JIT-compiled functions with debugger."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &jit_debugging_support,
+ false,
+
+ /*
+ * This is not guaranteed to be available, but given it's a developer
+ * oriented option, it doesn't seem worth adding code checking
+ * availability.
+ */
+ NULL,
+ NULL,
+ NULL},
+
+ {{"jit_dump_bitcode", PGC_SUSET, DEVELOPER_OPTIONS,
+ gettext_noop("Write out LLVM bitcode to facilitate JIT debugging."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &jit_dump_bitcode,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"jit_expressions", PGC_USERSET, DEVELOPER_OPTIONS,
+ gettext_noop("Allow JIT compilation of expressions."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &jit_expressions,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{"jit_profiling_support", PGC_SU_BACKEND, DEVELOPER_OPTIONS,
+ gettext_noop("Register JIT-compiled functions with perf profiler."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &jit_profiling_support,
+ false,
+
+ /*
+ * This is not guaranteed to be available, but given it's a developer
+ * oriented option, it doesn't seem worth adding code checking
+ * availability.
+ */
+ NULL,
+ NULL,
+ NULL},
+
+ {{"jit_tuple_deforming", PGC_USERSET, DEVELOPER_OPTIONS,
+ gettext_noop("Allow JIT compilation of tuple deforming."),
+ NULL,
+ GUC_NOT_IN_SAMPLE},
+ &jit_tuple_deforming,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{
+ "data_sync_retry",
+ PGC_POSTMASTER,
+ ERROR_HANDLING_OPTIONS,
+ gettext_noop("Whether to continue running after a failure to sync data files."),
+ },
+ &data_sync_retry,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{
+ "wal_receiver_create_temp_slot",
+ PGC_SIGHUP,
+ REPLICATION_STANDBY,
+ gettext_noop("Sets whether a WAL receiver should create a temporary replication slot if no permanent slot is configured."),
+ },
+ &wal_receiver_create_temp_slot,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{
+ "event_triggers",
+ PGC_SUSET,
+ CLIENT_CONN_STATEMENT,
+ gettext_noop("Enables event triggers."),
+ gettext_noop("When enabled, event triggers will fire for all applicable statements."),
+ },
+ &event_triggers,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{
+ "sync_replication_slots",
+ PGC_SIGHUP,
+ REPLICATION_STANDBY,
+ gettext_noop("Enables a physical standby to synchronize logical failover replication slots from the primary server."),
+ },
+ &sync_replication_slots,
+ false,
+ NULL,
+ NULL,
+ NULL},
+
+ {{
+ "md5_password_warnings",
+ PGC_USERSET,
+ CONN_AUTH_AUTH,
+ gettext_noop("Enables deprecation warnings for MD5 passwords."),
+ },
+ &md5_password_warnings,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ {{
+ "vacuum_truncate",
+ PGC_USERSET,
+ VACUUM_DEFAULT,
+ gettext_noop("Enables vacuum to truncate empty pages at the end of the table."),
+ },
+ &vacuum_truncate,
+ true,
+ NULL,
+ NULL,
+ NULL},
+
+ /* End-of-list marker */
+ {
+ {NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL, NULL}};
struct config_int ConfigureNamesInt[] =
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index a9d8293474a..26c08693564 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -581,6 +581,7 @@
# - What to Log -
+#debug_print_raw_parse = off
#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index f619100467d..d06ddade7f0 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -247,6 +247,7 @@ typedef enum
/* GUC vars that are actually defined in guc_tables.c, rather than elsewhere */
extern PGDLLIMPORT bool Debug_print_plan;
extern PGDLLIMPORT bool Debug_print_parse;
+extern PGDLLIMPORT bool Debug_print_raw_parse;
extern PGDLLIMPORT bool Debug_print_rewritten;
extern PGDLLIMPORT bool Debug_pretty_print;
--
2.39.5 (Apple Git-154)
I just noticed that my IDE auto formatted guc_tables.c, which generated a
lot of unnecessary diffs. Recreated the patch, and attach the v2 version.
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/
Chao Li <li.evan.chao@gmail.com> 于2025年8月4日周一 15:57写道:
Show quoted text
Oh, I forget to attached the patch file, here comes it.
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Chao Li <li.evan.chao@gmail.com> 于2025年8月4日周一 15:53写道:
I was reviewing some patches today, and during debugging the patches, I
wanted to view raw parse tree, so I had to apply my local patch of dumping
raw parse for every review, which was so inconvenient.You may argue that raw parse tree might not be useful for every reviews.
I am still ramping up PG development, I'd like to tune SQL statements and
see differences of resulting parse trees.So, I made this patch. The change is quiet simple. I just searched for
"Debug_print_parse", and added a new option "Debug_print_raw_parse". Only
when the new option is turned on, raw parse tree will be dumped to logs.
This way will not make noise to people who are not interested in raw parse
tree.I have run the following tests:
1. In an existing database, edit postgres.conf and add
"debug_print_raw_parse = on", then raw parse tree is dumped to logs as
expected.
2. Init a new database, "debug_print_raw_parse = off" appears in
postgres.conf as expected.
3. "make check" passedThis patches touches config.sgml and rules.sgml, I don't know how to test
the doc changes, any suggestion?One thing I want reviewer's opinion is that, if start "postgres -d 3", it
originally only turn on debug_print_parse, now it will turn on
debug_print_raw_parse as well, which potentially make people who don't want
raw parse tree unhappy. Maybe use "-d 5" or not turning on
debug_print_raw_parse at all by "-d"? WDYT?Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Chao Li <li.evan.chao@gmail.com> 于2025年8月1日周五 16:10写道:
Hi Tatsuo, thanks for pointing out the past conversation.
So, the requirement got 1 more vote from me. But to not make noise to
people who are not interested in raw parse tree, I guess it's better to add
a new option "debug_print_raw_parse". For people who are interested in raw
parse tree, turning on a flag once is much more convenient than typing a
command in the debugger for every trace.I will wait to see if Tom still objects to adding that. I will not make
the code change unless I see a hint of "go".Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Tatsuo Ishii <ishii@postgresql.org> 于2025年8月1日周五 15:18写道:
Before submitting this trivial patch, I still want to confirm with the
community if it's intentional to not dump raw parse tree?For your reference, here's the past discussion:
/messages/by-id/20080730.172949.132921436.t-ishii@sraoss.co.jp
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Attachments:
v2-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchapplication/octet-stream; name=v2-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchDownload
From d1e883fa81ebc50b211cbcf9573fd39454169cee Mon Sep 17 00:00:00 2001
From: "Chao Li (HighGo Inc.)" <li.evan.chao@gmail.com>
Date: Thu, 31 Jul 2025 17:02:32 +0800
Subject: [PATCH v2] Add support for dumping raw parse tree with
debug_print_raw_parse
This patch introduces a small change to log the raw parse tree in the
same way we currently log the parse tree, rewritten tree, and plan tree.
While tracing some queries, I found that being able to inspect the raw
parse tree is also helpful for understanding query transformation.
Although the raw parse tree can be inspected via a debugger, having it
logged simplifies the workflow for those interested in this stage of
query processing, without requiring a debugging session.
To avoid unnecessary log noise for users not interested in this detail,
a new GUC option, "debug_print_raw_parse", has been added.
When starting the PostgreSQL process with "-d N", and N is 3 or higher,
debug_print_raw_parse is enabled automatically, alongside
debug_print_parse.
Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAEoWx2mcO0Gpo4vd8kPMAFWeJLSp0MeUUnaLdE1x0tSVd-VzUw%40mail.gmail.com
---
doc/src/sgml/config.sgml | 8 +++++++-
src/backend/tcop/postgres.c | 7 +++++++
src/backend/utils/misc/guc_tables.c | 10 ++++++++++
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/include/utils/guc.h | 1 +
5 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 20ccb2d6b54..4370e8307f2 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7382,6 +7382,11 @@ local0.* /var/log/postgresql
</varlistentry>
<varlistentry id="guc-debug-print-parse">
+ <term><varname>debug_print_raw_parse</varname> (<type>boolean</type>)
+ <indexterm>
+ <primary><varname>debug_print_raw_parse</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
<term><varname>debug_print_parse</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>debug_print_parse</varname> configuration parameter</primary>
@@ -7421,7 +7426,8 @@ local0.* /var/log/postgresql
<listitem>
<para>
When set, <varname>debug_pretty_print</varname> indents the messages
- produced by <varname>debug_print_parse</varname>,
+ produced by <varname>debug_print_raw_parse</varname>,
+ <varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. This results in more readable
but much longer output than the <quote>compact</quote> format used when
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 0cecd464902..d356830f756 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (Debug_print_raw_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
return raw_parsetree_list;
}
@@ -3697,7 +3701,10 @@ set_debug_options(int debug_flag, GucContext context, GucSource source)
if (debug_flag >= 2)
SetConfigOption("log_statement", "all", context, source);
if (debug_flag >= 3)
+ {
+ SetConfigOption("debug_print_raw_parse", "true", context, source);
SetConfigOption("debug_print_parse", "true", context, source);
+ }
if (debug_flag >= 4)
SetConfigOption("debug_print_plan", "true", context, source);
if (debug_flag >= 5)
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index d14b1678e7f..f4e0b6a5274 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -507,6 +507,7 @@ bool AllowAlterSystem = true;
bool log_duration = false;
bool Debug_print_plan = false;
bool Debug_print_parse = false;
+bool Debug_print_raw_parse = false;
bool Debug_print_rewritten = false;
bool Debug_pretty_print = true;
@@ -1385,6 +1386,15 @@ struct config_bool ConfigureNamesBool[] =
NULL, NULL, NULL
},
#endif /* DEBUG_NODE_TESTS_ENABLED */
+ {
+ {"debug_print_raw_parse", PGC_USERSET, LOGGING_WHAT,
+ gettext_noop("Logs each query's raw parse tree."),
+ NULL
+ },
+ &Debug_print_raw_parse,
+ false,
+ NULL, NULL, NULL
+ },
{
{"debug_print_parse", PGC_USERSET, LOGGING_WHAT,
gettext_noop("Logs each query's parse tree."),
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index a9d8293474a..26c08693564 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -581,6 +581,7 @@
# - What to Log -
+#debug_print_raw_parse = off
#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index f619100467d..d06ddade7f0 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -247,6 +247,7 @@ typedef enum
/* GUC vars that are actually defined in guc_tables.c, rather than elsewhere */
extern PGDLLIMPORT bool Debug_print_plan;
extern PGDLLIMPORT bool Debug_print_parse;
+extern PGDLLIMPORT bool Debug_print_raw_parse;
extern PGDLLIMPORT bool Debug_print_rewritten;
extern PGDLLIMPORT bool Debug_pretty_print;
--
2.39.5 (Apple Git-154)
CommitFests patch created: https://commitfest.postgresql.org/patch/5946/
Show quoted text
2025年8月4日 16:17,Chao Li <li.evan.chao@gmail.com> 写道:
I just noticed that my IDE auto formatted guc_tables.c, which generated a lot of unnecessary diffs. Recreated the patch, and attach the v2 version.
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Chao Li <li.evan.chao@gmail.com <mailto:li.evan.chao@gmail.com>> 于2025年8月4日周一 15:57写道:
Oh, I forget to attached the patch file, here comes it.
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Chao Li <li.evan.chao@gmail.com <mailto:li.evan.chao@gmail.com>> 于2025年8月4日周一 15:53写道:
I was reviewing some patches today, and during debugging the patches, I wanted to view raw parse tree, so I had to apply my local patch of dumping raw parse for every review, which was so inconvenient.
You may argue that raw parse tree might not be useful for every reviews. I am still ramping up PG development, I'd like to tune SQL statements and see differences of resulting parse trees.
So, I made this patch. The change is quiet simple. I just searched for "Debug_print_parse", and added a new option "Debug_print_raw_parse". Only when the new option is turned on, raw parse tree will be dumped to logs. This way will not make noise to people who are not interested in raw parse tree.
I have run the following tests:
1. In an existing database, edit postgres.conf and add "debug_print_raw_parse = on", then raw parse tree is dumped to logs as expected.
2. Init a new database, "debug_print_raw_parse = off" appears in postgres.conf as expected.
3. "make check" passedThis patches touches config.sgml and rules.sgml, I don't know how to test the doc changes, any suggestion?
One thing I want reviewer's opinion is that, if start "postgres -d 3", it originally only turn on debug_print_parse, now it will turn on debug_print_raw_parse as well, which potentially make people who don't want raw parse tree unhappy. Maybe use "-d 5" or not turning on debug_print_raw_parse at all by "-d"? WDYT?
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Chao Li <li.evan.chao@gmail.com <mailto:li.evan.chao@gmail.com>> 于2025年8月1日周五 16:10写道:
Hi Tatsuo, thanks for pointing out the past conversation.
So, the requirement got 1 more vote from me. But to not make noise to people who are not interested in raw parse tree, I guess it's better to add a new option "debug_print_raw_parse". For people who are interested in raw parse tree, turning on a flag once is much more convenient than typing a command in the debugger for every trace.
I will wait to see if Tom still objects to adding that. I will not make the code change unless I see a hint of "go".
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Tatsuo Ishii <ishii@postgresql.org <mailto:ishii@postgresql.org>> 于2025年8月1日周五 15:18写道:
Before submitting this trivial patch, I still want to confirm with the
community if it's intentional to not dump raw parse tree?For your reference, here's the past discussion:
/messages/by-id/20080730.172949.132921436.t-ishii@sraoss.co.jpBest regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp <http://www.sraoss.co.jp/><v2-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patch>
Updated the patch to v3 version.
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/
Chao Li <li.evan.chao@gmail.com> 于2025年8月5日周二 14:25写道:
Show quoted text
CommitFests patch created: https://commitfest.postgresql.org/patch/5946/
2025年8月4日 16:17,Chao Li <li.evan.chao@gmail.com> 写道:
I just noticed that my IDE auto formatted guc_tables.c, which generated a
lot of unnecessary diffs. Recreated the patch, and attach the v2 version.Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Chao Li <li.evan.chao@gmail.com> 于2025年8月4日周一 15:57写道:
Oh, I forget to attached the patch file, here comes it.
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Chao Li <li.evan.chao@gmail.com> 于2025年8月4日周一 15:53写道:
I was reviewing some patches today, and during debugging the patches, I
wanted to view raw parse tree, so I had to apply my local patch of dumping
raw parse for every review, which was so inconvenient.You may argue that raw parse tree might not be useful for every reviews.
I am still ramping up PG development, I'd like to tune SQL statements and
see differences of resulting parse trees.So, I made this patch. The change is quiet simple. I just searched for
"Debug_print_parse", and added a new option "Debug_print_raw_parse". Only
when the new option is turned on, raw parse tree will be dumped to logs.
This way will not make noise to people who are not interested in raw parse
tree.I have run the following tests:
1. In an existing database, edit postgres.conf and add
"debug_print_raw_parse = on", then raw parse tree is dumped to logs as
expected.
2. Init a new database, "debug_print_raw_parse = off" appears in
postgres.conf as expected.
3. "make check" passedThis patches touches config.sgml and rules.sgml, I don't know how to
test the doc changes, any suggestion?One thing I want reviewer's opinion is that, if start "postgres -d 3",
it originally only turn on debug_print_parse, now it will turn on
debug_print_raw_parse as well, which potentially make people who don't want
raw parse tree unhappy. Maybe use "-d 5" or not turning on
debug_print_raw_parse at all by "-d"? WDYT?Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Chao Li <li.evan.chao@gmail.com> 于2025年8月1日周五 16:10写道:
Hi Tatsuo, thanks for pointing out the past conversation.
So, the requirement got 1 more vote from me. But to not make noise to
people who are not interested in raw parse tree, I guess it's better to add
a new option "debug_print_raw_parse". For people who are interested in raw
parse tree, turning on a flag once is much more convenient than typing a
command in the debugger for every trace.I will wait to see if Tom still objects to adding that. I will not make
the code change unless I see a hint of "go".Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/Tatsuo Ishii <ishii@postgresql.org> 于2025年8月1日周五 15:18写道:
Before submitting this trivial patch, I still want to confirm with
the
community if it's intentional to not dump raw parse tree?
For your reference, here's the past discussion:
/messages/by-id/20080730.172949.132921436.t-ishii@sraoss.co.jp
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp<v2-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patch>
Attachments:
v3-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchapplication/octet-stream; name=v3-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchDownload
From 360f476550248d65ab9918a7a38c950c3c2f5b0e Mon Sep 17 00:00:00 2001
From: "Chao Li (HighGo Inc.)" <li.evan.chao@gmail.com>
Date: Thu, 31 Jul 2025 17:02:32 +0800
Subject: [PATCH v3] Add support for dumping raw parse tree with
debug_print_raw_parse
This patch introduces a small change to log the raw parse tree in the
same way we currently log the parse tree, rewritten tree, and plan tree.
While tracing some queries, I found that being able to inspect the raw
parse tree is also helpful for understanding query transformation.
Although the raw parse tree can be inspected via a debugger, having it
logged simplifies the workflow for those interested in this stage of
query processing, without requiring a debugging session.
To avoid unnecessary log noise for users not interested in this detail,
a new GUC option, "debug_print_raw_parse", has been added.
When starting the PostgreSQL process with "-d N", and N is 3 or higher,
debug_print_raw_parse is enabled automatically, alongside
debug_print_parse.
Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/CAEoWx2mcO0Gpo4vd8kPMAFWeJLSp0MeUUnaLdE1x0tSVd-VzUw%40mail.gmail.com
---
doc/src/sgml/config.sgml | 8 +++++++-
doc/src/sgml/rules.sgml | 1 +
src/backend/tcop/postgres.c | 7 +++++++
src/backend/utils/misc/guc_tables.c | 10 ++++++++++
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/include/utils/guc.h | 1 +
6 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 20ccb2d6b54..4370e8307f2 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7382,6 +7382,11 @@ local0.* /var/log/postgresql
</varlistentry>
<varlistentry id="guc-debug-print-parse">
+ <term><varname>debug_print_raw_parse</varname> (<type>boolean</type>)
+ <indexterm>
+ <primary><varname>debug_print_raw_parse</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
<term><varname>debug_print_parse</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>debug_print_parse</varname> configuration parameter</primary>
@@ -7421,7 +7426,8 @@ local0.* /var/log/postgresql
<listitem>
<para>
When set, <varname>debug_pretty_print</varname> indents the messages
- produced by <varname>debug_print_parse</varname>,
+ produced by <varname>debug_print_raw_parse</varname>,
+ <varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. This results in more readable
but much longer output than the <quote>compact</quote> format used when
diff --git a/doc/src/sgml/rules.sgml b/doc/src/sgml/rules.sgml
index 8467d961fd0..282dcd722d4 100644
--- a/doc/src/sgml/rules.sgml
+++ b/doc/src/sgml/rules.sgml
@@ -60,6 +60,7 @@
<acronym>SQL</acronym> statement where the single parts that it is
built from are stored separately. These query trees can be shown
in the server log if you set the configuration parameters
+ <varname>debug_print_raw_parse</varname>,
<varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. The rule actions are also
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 0cecd464902..d356830f756 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (Debug_print_raw_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
return raw_parsetree_list;
}
@@ -3697,7 +3701,10 @@ set_debug_options(int debug_flag, GucContext context, GucSource source)
if (debug_flag >= 2)
SetConfigOption("log_statement", "all", context, source);
if (debug_flag >= 3)
+ {
+ SetConfigOption("debug_print_raw_parse", "true", context, source);
SetConfigOption("debug_print_parse", "true", context, source);
+ }
if (debug_flag >= 4)
SetConfigOption("debug_print_plan", "true", context, source);
if (debug_flag >= 5)
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index d14b1678e7f..f4e0b6a5274 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -507,6 +507,7 @@ bool AllowAlterSystem = true;
bool log_duration = false;
bool Debug_print_plan = false;
bool Debug_print_parse = false;
+bool Debug_print_raw_parse = false;
bool Debug_print_rewritten = false;
bool Debug_pretty_print = true;
@@ -1385,6 +1386,15 @@ struct config_bool ConfigureNamesBool[] =
NULL, NULL, NULL
},
#endif /* DEBUG_NODE_TESTS_ENABLED */
+ {
+ {"debug_print_raw_parse", PGC_USERSET, LOGGING_WHAT,
+ gettext_noop("Logs each query's raw parse tree."),
+ NULL
+ },
+ &Debug_print_raw_parse,
+ false,
+ NULL, NULL, NULL
+ },
{
{"debug_print_parse", PGC_USERSET, LOGGING_WHAT,
gettext_noop("Logs each query's parse tree."),
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index a9d8293474a..26c08693564 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -581,6 +581,7 @@
# - What to Log -
+#debug_print_raw_parse = off
#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index f619100467d..d06ddade7f0 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -247,6 +247,7 @@ typedef enum
/* GUC vars that are actually defined in guc_tables.c, rather than elsewhere */
extern PGDLLIMPORT bool Debug_print_plan;
extern PGDLLIMPORT bool Debug_print_parse;
+extern PGDLLIMPORT bool Debug_print_raw_parse;
extern PGDLLIMPORT bool Debug_print_rewritten;
extern PGDLLIMPORT bool Debug_pretty_print;
--
2.39.5 (Apple Git-154)
Updated the patch to v3 version.
I have looked into this patch.
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 20ccb2d6b54..4370e8307f2 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
Around line 7407 of config.sgml:
These parameters enable various debugging output to be emitted.
When set, they print the resulting parse tree, the query rewriter
output, or the execution plan for each executed query.
I think you should add "the resulting raw parse tree" before "the
resulting parse tree" since the paragraph refers to the each item in
the varlistentry above.
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (Debug_print_raw_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
I'm tempted to change "if (Debug_print_raw_parse)" to:
if (unlikely(Debug_print_raw_parse))
But as we have similar if-statements elsewhere
(e.g. Debug_print_parse), maybe we should keep it for a separate
commit.
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Hi Tatsuo san,
Thank you very much for your review.
On 2025/8/16 13:56, Tatsuo Ishii wrote:
I have looked into this patch.
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 20ccb2d6b54..4370e8307f2 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgmlAround line 7407 of config.sgml:
I think you should add "the resulting raw parse tree" before "the
resulting parse tree" since the paragraph refers to the each item in
the varlistentry above.
Updated.
--- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (Debug_print_raw_parse) + elog_node_display(LOG, "raw parse tree", raw_parsetree_list, + Debug_pretty_print); +I'm tempted to change "if (Debug_print_raw_parse)" to:
if (unlikely(Debug_print_raw_parse))
But as we have similar if-statements elsewhere
(e.g. Debug_print_parse), maybe we should keep it for a separate
commit.
I have added "unlikely" here. For other places, I can use a separate
commit to add "unlikely".
Best regards,
--
Chao Li (Evan)
------------------------------
HighGo Software Inc.
https://www.highgo.com/
Attachments:
v4-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchtext/plain; charset=UTF-8; name=v4-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchDownload
From bef138c16e78c815bb653db37a01c28cd024abd5 Mon Sep 17 00:00:00 2001
From: "Chao Li (HighGo Inc.)" <li.evan.chao@gmail.com>
Date: Thu, 31 Jul 2025 17:02:32 +0800
Subject: [PATCH v4] Add support for dumping raw parse tree with
debug_print_raw_parse
This patch introduces a small change to log the raw parse tree in the
same way we currently log the parse tree, rewritten tree, and plan tree.
While tracing some queries, I found that being able to inspect the raw
parse tree is also helpful for understanding query transformation.
Although the raw parse tree can be inspected via a debugger, having it
logged simplifies the workflow for those interested in this stage of
query processing, without requiring a debugging session.
To avoid unnecessary log noise for users not interested in this detail,
a new GUC option, "debug_print_raw_parse", has been added.
When starting the PostgreSQL process with "-d N", and N is 3 or higher,
debug_print_raw_parse is enabled automatically, alongside
debug_print_parse.
Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/CAEoWx2mcO0Gpo4vd8kPMAFWeJLSp0MeUUnaLdE1x0tSVd-VzUw%40mail.gmail.com
---
doc/src/sgml/config.sgml | 12 +++++++++---
doc/src/sgml/rules.sgml | 1 +
src/backend/tcop/postgres.c | 7 +++++++
src/backend/utils/misc/guc_tables.c | 10 ++++++++++
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/include/utils/guc.h | 1 +
6 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 20ccb2d6b54..212dcb7f0c3 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7382,6 +7382,11 @@ local0.* /var/log/postgresql
</varlistentry>
<varlistentry id="guc-debug-print-parse">
+ <term><varname>debug_print_raw_parse</varname> (<type>boolean</type>)
+ <indexterm>
+ <primary><varname>debug_print_raw_parse</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
<term><varname>debug_print_parse</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>debug_print_parse</varname> configuration parameter</primary>
@@ -7400,8 +7405,8 @@ local0.* /var/log/postgresql
<listitem>
<para>
These parameters enable various debugging output to be emitted.
- When set, they print the resulting parse tree, the query rewriter
- output, or the execution plan for each executed query.
+ When set, they print the resulting raw parse tree, the parse tree, the query
+ rewriter output, or the execution plan for each executed query.
These messages are emitted at <literal>LOG</literal> message level, so by
default they will appear in the server log but will not be sent to the
client. You can change that by adjusting
@@ -7421,7 +7426,8 @@ local0.* /var/log/postgresql
<listitem>
<para>
When set, <varname>debug_pretty_print</varname> indents the messages
- produced by <varname>debug_print_parse</varname>,
+ produced by <varname>debug_print_raw_parse</varname>,
+ <varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. This results in more readable
but much longer output than the <quote>compact</quote> format used when
diff --git a/doc/src/sgml/rules.sgml b/doc/src/sgml/rules.sgml
index 8467d961fd0..282dcd722d4 100644
--- a/doc/src/sgml/rules.sgml
+++ b/doc/src/sgml/rules.sgml
@@ -60,6 +60,7 @@
<acronym>SQL</acronym> statement where the single parts that it is
built from are stored separately. These query trees can be shown
in the server log if you set the configuration parameters
+ <varname>debug_print_raw_parse</varname>,
<varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. The rule actions are also
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 0cecd464902..e9debaad2c4 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (unlikely(Debug_print_parse))
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
return raw_parsetree_list;
}
@@ -3697,7 +3701,10 @@ set_debug_options(int debug_flag, GucContext context, GucSource source)
if (debug_flag >= 2)
SetConfigOption("log_statement", "all", context, source);
if (debug_flag >= 3)
+ {
+ SetConfigOption("debug_print_raw_parse", "true", context, source);
SetConfigOption("debug_print_parse", "true", context, source);
+ }
if (debug_flag >= 4)
SetConfigOption("debug_print_plan", "true", context, source);
if (debug_flag >= 5)
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index d14b1678e7f..f4e0b6a5274 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -507,6 +507,7 @@ bool AllowAlterSystem = true;
bool log_duration = false;
bool Debug_print_plan = false;
bool Debug_print_parse = false;
+bool Debug_print_raw_parse = false;
bool Debug_print_rewritten = false;
bool Debug_pretty_print = true;
@@ -1385,6 +1386,15 @@ struct config_bool ConfigureNamesBool[] =
NULL, NULL, NULL
},
#endif /* DEBUG_NODE_TESTS_ENABLED */
+ {
+ {"debug_print_raw_parse", PGC_USERSET, LOGGING_WHAT,
+ gettext_noop("Logs each query's raw parse tree."),
+ NULL
+ },
+ &Debug_print_raw_parse,
+ false,
+ NULL, NULL, NULL
+ },
{
{"debug_print_parse", PGC_USERSET, LOGGING_WHAT,
gettext_noop("Logs each query's parse tree."),
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index a9d8293474a..26c08693564 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -581,6 +581,7 @@
# - What to Log -
+#debug_print_raw_parse = off
#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index f619100467d..d06ddade7f0 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -247,6 +247,7 @@ typedef enum
/* GUC vars that are actually defined in guc_tables.c, rather than elsewhere */
extern PGDLLIMPORT bool Debug_print_plan;
extern PGDLLIMPORT bool Debug_print_parse;
+extern PGDLLIMPORT bool Debug_print_raw_parse;
extern PGDLLIMPORT bool Debug_print_rewritten;
extern PGDLLIMPORT bool Debug_pretty_print;
--
2.39.5 (Apple Git-154)
--- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -649,6 +649,10 @@ pg_parse_query(const char *query_string) TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string); + if (Debug_print_raw_parse) + elog_node_display(LOG, "raw parse tree", raw_parsetree_list, + Debug_pretty_print); +I'm tempted to change "if (Debug_print_raw_parse)" to:
if (unlikely(Debug_print_raw_parse))
But as we have similar if-statements elsewhere
(e.g. Debug_print_parse), maybe we should keep it for a separate
commit.I have added "unlikely" here. For other places, I can use a separate
commit to add "unlikely".
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (unlikely(Debug_print_parse))
This should be:
+ if (unlikely(Debug_print_raw_parse))
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
On 2025/8/18 17:13, Tatsuo Ishii wrote:
+ if (unlikely(Debug_print_parse))
This should be:
+ if (unlikely(Debug_print_raw_parse))
My bad! Such a stupid mistake. Fixed. And I did a test by turning on/off
the flag in postgres.conf, and raw parse tree is only dumped when
"debug_print_raw_parse" is "on".
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
Attachments:
v5-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchtext/plain; charset=UTF-8; name=v5-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchDownload
From a2501a6cb70a9bb198163acbdef043290fd85b53 Mon Sep 17 00:00:00 2001
From: "Chao Li (HighGo Inc.)" <li.evan.chao@gmail.com>
Date: Thu, 31 Jul 2025 17:02:32 +0800
Subject: [PATCH v5] Add support for dumping raw parse tree with
debug_print_raw_parse
This patch introduces a small change to log the raw parse tree in the
same way we currently log the parse tree, rewritten tree, and plan tree.
While tracing some queries, I found that being able to inspect the raw
parse tree is also helpful for understanding query transformation.
Although the raw parse tree can be inspected via a debugger, having it
logged simplifies the workflow for those interested in this stage of
query processing, without requiring a debugging session.
To avoid unnecessary log noise for users not interested in this detail,
a new GUC option, "debug_print_raw_parse", has been added.
When starting the PostgreSQL process with "-d N", and N is 3 or higher,
debug_print_raw_parse is enabled automatically, alongside
debug_print_parse.
Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/CAEoWx2mcO0Gpo4vd8kPMAFWeJLSp0MeUUnaLdE1x0tSVd-VzUw%40mail.gmail.com
---
doc/src/sgml/config.sgml | 12 +++++++++---
doc/src/sgml/rules.sgml | 1 +
src/backend/tcop/postgres.c | 7 +++++++
src/backend/utils/misc/guc_tables.c | 10 ++++++++++
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/include/utils/guc.h | 1 +
6 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 20ccb2d6b54..212dcb7f0c3 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7382,6 +7382,11 @@ local0.* /var/log/postgresql
</varlistentry>
<varlistentry id="guc-debug-print-parse">
+ <term><varname>debug_print_raw_parse</varname> (<type>boolean</type>)
+ <indexterm>
+ <primary><varname>debug_print_raw_parse</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
<term><varname>debug_print_parse</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>debug_print_parse</varname> configuration parameter</primary>
@@ -7400,8 +7405,8 @@ local0.* /var/log/postgresql
<listitem>
<para>
These parameters enable various debugging output to be emitted.
- When set, they print the resulting parse tree, the query rewriter
- output, or the execution plan for each executed query.
+ When set, they print the resulting raw parse tree, the parse tree, the query
+ rewriter output, or the execution plan for each executed query.
These messages are emitted at <literal>LOG</literal> message level, so by
default they will appear in the server log but will not be sent to the
client. You can change that by adjusting
@@ -7421,7 +7426,8 @@ local0.* /var/log/postgresql
<listitem>
<para>
When set, <varname>debug_pretty_print</varname> indents the messages
- produced by <varname>debug_print_parse</varname>,
+ produced by <varname>debug_print_raw_parse</varname>,
+ <varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. This results in more readable
but much longer output than the <quote>compact</quote> format used when
diff --git a/doc/src/sgml/rules.sgml b/doc/src/sgml/rules.sgml
index 8467d961fd0..282dcd722d4 100644
--- a/doc/src/sgml/rules.sgml
+++ b/doc/src/sgml/rules.sgml
@@ -60,6 +60,7 @@
<acronym>SQL</acronym> statement where the single parts that it is
built from are stored separately. These query trees can be shown
in the server log if you set the configuration parameters
+ <varname>debug_print_raw_parse</varname>,
<varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. The rule actions are also
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 0cecd464902..e519e92087a 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (unlikely(Debug_print_raw_parse))
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
return raw_parsetree_list;
}
@@ -3697,7 +3701,10 @@ set_debug_options(int debug_flag, GucContext context, GucSource source)
if (debug_flag >= 2)
SetConfigOption("log_statement", "all", context, source);
if (debug_flag >= 3)
+ {
+ SetConfigOption("debug_print_raw_parse", "true", context, source);
SetConfigOption("debug_print_parse", "true", context, source);
+ }
if (debug_flag >= 4)
SetConfigOption("debug_print_plan", "true", context, source);
if (debug_flag >= 5)
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index d14b1678e7f..f4e0b6a5274 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -507,6 +507,7 @@ bool AllowAlterSystem = true;
bool log_duration = false;
bool Debug_print_plan = false;
bool Debug_print_parse = false;
+bool Debug_print_raw_parse = false;
bool Debug_print_rewritten = false;
bool Debug_pretty_print = true;
@@ -1385,6 +1386,15 @@ struct config_bool ConfigureNamesBool[] =
NULL, NULL, NULL
},
#endif /* DEBUG_NODE_TESTS_ENABLED */
+ {
+ {"debug_print_raw_parse", PGC_USERSET, LOGGING_WHAT,
+ gettext_noop("Logs each query's raw parse tree."),
+ NULL
+ },
+ &Debug_print_raw_parse,
+ false,
+ NULL, NULL, NULL
+ },
{
{"debug_print_parse", PGC_USERSET, LOGGING_WHAT,
gettext_noop("Logs each query's parse tree."),
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index a9d8293474a..26c08693564 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -581,6 +581,7 @@
# - What to Log -
+#debug_print_raw_parse = off
#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index f619100467d..d06ddade7f0 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -247,6 +247,7 @@ typedef enum
/* GUC vars that are actually defined in guc_tables.c, rather than elsewhere */
extern PGDLLIMPORT bool Debug_print_plan;
extern PGDLLIMPORT bool Debug_print_parse;
+extern PGDLLIMPORT bool Debug_print_raw_parse;
extern PGDLLIMPORT bool Debug_print_rewritten;
extern PGDLLIMPORT bool Debug_pretty_print;
--
2.39.5 (Apple Git-154)
On 2025/8/18 17:13, Tatsuo Ishii wrote:
+ if (unlikely(Debug_print_parse))
This should be:
+ if (unlikely(Debug_print_raw_parse))
My bad! Such a stupid mistake. Fixed. And I did a test by turning
on/off the flag in postgres.conf, and raw parse tree is only dumped
when "debug_print_raw_parse" is "on".
Thanks for updating the patch.
v5 patch looks good to me. If there's no objection, I plan to push the
patch in early September.
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
On Aug 20, 2025, at 09:25, Tatsuo Ishii <ishii@postgresql.org> wrote:
v5 patch looks good to me. If there's no objection, I plan to push the
patch in early September.
Hi Tatsuo san,
Thank you much very for your support.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
On Wed, Aug 20, 2025 at 8:26 AM Tatsuo Ishii <ishii@postgresql.org> wrote:
Thanks for updating the patch.
v5 patch looks good to me. If there's no objection, I plan to push the
patch in early September.
+ if (unlikely(Debug_print_raw_parse))
Branch alignment surely shouldn't matter in a function that is called
once per query?
--
John Naylor
Amazon Web Services
+ if (unlikely(Debug_print_raw_parse))
Branch alignment surely shouldn't matter in a function that is called
once per query?
According to my test, it seems using unlikely() makes a small but
non-negligible performance improvement over the code without
unlikely() for small queries.
Test method: Apply the latest patch (it needs rebasing) to master.
Disable debug_print_raw_parse. Run pgbench with following arguments:
$ pgbench -c 10 -j 10 -f bench.sql -T 60 test
cat bench.sql
SELECT 1;
I ran pgbench 3 times and here's the results:
case 1: with patch (unlikely() is used)
tps = 63279.645198 (without initial connection time)
tps = 62385.016698 (without initial connection time)
tps = 62950.431703 (without initial connection time)
average: 62871.697866
case 2: with patch (unlikely() is not used)
tps = 62462.798551 (without initial connection time)
tps = 63085.646278 (without initial connection time)
tps = 61361.373551 (without initial connection time)
average: 62303.272793
case 1 (62871.697866) / case 2 (62303.272793) = 1.009213
It seems case 1 (unlikely() is used) is about 0.9% faster than case
2 (unlikely() is used).
Comments?
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Hi Chao Li,
v5 patch looks good to me. If there's no objection, I plan to push the
patch in early September.Hi Tatsuo san,
Thank you much very for your support.
You are welcome.
Can you please rebase v5 patch? It does not apply to current master
anymore.
$ git apply ~/v5-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patch
error: patch failed: src/backend/utils/misc/guc_tables.c:1385
error: src/backend/utils/misc/guc_tables.c: patch does not apply
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Hi Tatsuo san,
Rebased v6 is attached.
Chao Li (Evan)
---------------------
HighGo Software Co., Ltd.
https://www.highgo.com/
Tatsuo Ishii <ishii@postgresql.org> 于2025年9月1日周一 10:13写道:
Show quoted text
Hi Chao Li,
v5 patch looks good to me. If there's no objection, I plan to push the
patch in early September.Hi Tatsuo san,
Thank you much very for your support.
You are welcome.
Can you please rebase v5 patch? It does not apply to current master
anymore.$ git apply
~/v5-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patch
error: patch failed: src/backend/utils/misc/guc_tables.c:1385
error: src/backend/utils/misc/guc_tables.c: patch does not applyBest regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Attachments:
v6-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchapplication/octet-stream; name=v6-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchDownload
From 11a0c67c94ddcb3f9ad0ef8a2ca9a9035a5d7c32 Mon Sep 17 00:00:00 2001
From: "Chao Li (HighGo Inc.)" <li.evan.chao@gmail.com>
Date: Thu, 31 Jul 2025 17:02:32 +0800
Subject: [PATCH v6] Add support for dumping raw parse tree with
debug_print_raw_parse
This patch introduces a small change to log the raw parse tree in the
same way we currently log the parse tree, rewritten tree, and plan tree.
While tracing some queries, I found that being able to inspect the raw
parse tree is also helpful for understanding query transformation.
Although the raw parse tree can be inspected via a debugger, having it
logged simplifies the workflow for those interested in this stage of
query processing, without requiring a debugging session.
To avoid unnecessary log noise for users not interested in this detail,
a new GUC option, "debug_print_raw_parse", has been added.
When starting the PostgreSQL process with "-d N", and N is 3 or higher,
debug_print_raw_parse is enabled automatically, alongside
debug_print_parse.
Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/CAEoWx2mcO0Gpo4vd8kPMAFWeJLSp0MeUUnaLdE1x0tSVd-VzUw%40mail.gmail.com
---
doc/src/sgml/config.sgml | 12 +++++++++---
doc/src/sgml/rules.sgml | 1 +
src/backend/tcop/postgres.c | 7 +++++++
src/backend/utils/misc/guc_tables.c | 10 ++++++++++
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/include/utils/guc.h | 1 +
6 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 0a4b3e55ba5..2a3685f474a 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7383,6 +7383,11 @@ local0.* /var/log/postgresql
</varlistentry>
<varlistentry id="guc-debug-print-parse">
+ <term><varname>debug_print_raw_parse</varname> (<type>boolean</type>)
+ <indexterm>
+ <primary><varname>debug_print_raw_parse</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
<term><varname>debug_print_parse</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>debug_print_parse</varname> configuration parameter</primary>
@@ -7401,8 +7406,8 @@ local0.* /var/log/postgresql
<listitem>
<para>
These parameters enable various debugging output to be emitted.
- When set, they print the resulting parse tree, the query rewriter
- output, or the execution plan for each executed query.
+ When set, they print the resulting raw parse tree, the parse tree, the query
+ rewriter output, or the execution plan for each executed query.
These messages are emitted at <literal>LOG</literal> message level, so by
default they will appear in the server log but will not be sent to the
client. You can change that by adjusting
@@ -7422,7 +7427,8 @@ local0.* /var/log/postgresql
<listitem>
<para>
When set, <varname>debug_pretty_print</varname> indents the messages
- produced by <varname>debug_print_parse</varname>,
+ produced by <varname>debug_print_raw_parse</varname>,
+ <varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. This results in more readable
but much longer output than the <quote>compact</quote> format used when
diff --git a/doc/src/sgml/rules.sgml b/doc/src/sgml/rules.sgml
index 8467d961fd0..282dcd722d4 100644
--- a/doc/src/sgml/rules.sgml
+++ b/doc/src/sgml/rules.sgml
@@ -60,6 +60,7 @@
<acronym>SQL</acronym> statement where the single parts that it is
built from are stored separately. These query trees can be shown
in the server log if you set the configuration parameters
+ <varname>debug_print_raw_parse</varname>,
<varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. The rule actions are also
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 0cecd464902..e519e92087a 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (unlikely(Debug_print_raw_parse))
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
return raw_parsetree_list;
}
@@ -3697,7 +3701,10 @@ set_debug_options(int debug_flag, GucContext context, GucSource source)
if (debug_flag >= 2)
SetConfigOption("log_statement", "all", context, source);
if (debug_flag >= 3)
+ {
+ SetConfigOption("debug_print_raw_parse", "true", context, source);
SetConfigOption("debug_print_parse", "true", context, source);
+ }
if (debug_flag >= 4)
SetConfigOption("debug_print_plan", "true", context, source);
if (debug_flag >= 5)
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index f137129209f..4f3ae129e68 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -507,6 +507,7 @@ bool AllowAlterSystem = true;
bool log_duration = false;
bool Debug_print_plan = false;
bool Debug_print_parse = false;
+bool Debug_print_raw_parse = false;
bool Debug_print_rewritten = false;
bool Debug_pretty_print = true;
@@ -1433,6 +1434,15 @@ struct config_bool ConfigureNamesBool[] =
},
#endif /* DEBUG_NODE_TESTS_ENABLED */
+ {
+ {"debug_print_raw_parse", PGC_USERSET, LOGGING_WHAT,
+ gettext_noop("Logs each query's raw parse tree."),
+ NULL
+ },
+ &Debug_print_raw_parse,
+ false,
+ NULL, NULL, NULL
+ },
{
{"debug_print_parse", PGC_USERSET, LOGGING_WHAT,
gettext_noop("Logs each query's parse tree."),
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index a9d8293474a..26c08693564 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -581,6 +581,7 @@
# - What to Log -
+#debug_print_raw_parse = off
#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index f619100467d..d06ddade7f0 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -247,6 +247,7 @@ typedef enum
/* GUC vars that are actually defined in guc_tables.c, rather than elsewhere */
extern PGDLLIMPORT bool Debug_print_plan;
extern PGDLLIMPORT bool Debug_print_parse;
+extern PGDLLIMPORT bool Debug_print_raw_parse;
extern PGDLLIMPORT bool Debug_print_rewritten;
extern PGDLLIMPORT bool Debug_pretty_print;
--
2.39.5 (Apple Git-154)
On Mon, Sep 1, 2025 at 8:13 AM Tatsuo Ishii <ishii@postgresql.org> wrote:
Branch alignment surely shouldn't matter in a function that is called
once per query?According to my test, it seems using unlikely() makes a small but
non-negligible performance improvement over the code without
unlikely() for small queries.Test method: Apply the latest patch (it needs rebasing) to master.
Disable debug_print_raw_parse. Run pgbench with following arguments:$ pgbench -c 10 -j 10 -f bench.sql -T 60 test
cat bench.sql
SELECT 1;I ran pgbench 3 times and here's the results:
case 1: with patch (unlikely() is used)
tps = 63279.645198 (without initial connection time)
tps = 62385.016698 (without initial connection time)
tps = 62950.431703 (without initial connection time)
average: 62871.697866case 2: with patch (unlikely() is not used)
tps = 62462.798551 (without initial connection time)
tps = 63085.646278 (without initial connection time)
tps = 61361.373551 (without initial connection time)
average: 62303.272793case 1 (62871.697866) / case 2 (62303.272793) = 1.009213
It seems case 1 (unlikely() is used) is about 0.9% faster than case
2
The individual runs have quite a bit of variation.
It's good to cross check results against known facts. If my napkin
math is right, a ~1% speedup for ~60ktps/s amounts to saving ~160ns
per query. It's not plausible that forcing the compiler's hand for
this branch would save several hundred clock cycles.
To be fair I tried to reproduce and found only noise-level differences:
master: 61553
case 1: 61423
case 2: 61647
--
John Naylor
Amazon Web Services
The individual runs have quite a bit of variation.
It's a known behavior of pgbench.
It's good to cross check results against known facts. If my napkin
math is right, a ~1% speedup for ~60ktps/s amounts to saving ~160ns
per query. It's not plausible that forcing the compiler's hand for
this branch would save several hundred clock cycles.To be fair I tried to reproduce and found only noise-level differences:
master: 61553
case 1: 61423
case 2: 61647
That's 0.3% difference, definitely noise-level. Ok, I withdraw my
claim and commit the patch without unlikely().
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Hi Tatsuo san,
I just rebased the commit for the GUC change.
On Sep 3, 2025, at 09:57, Tatsuo Ishii <ishii@postgresql.org> wrote:
That's 0.3% difference, definitely noise-level. Ok, I withdraw my
claim and commit the patch without unlikely().
I also removed unlikely() in v7.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
Attachments:
v7-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchapplication/octet-stream; name=v7-0001-Add-support-for-dumping-raw-parse-tree-with-debug.patchDownload
From b586e56cd8d90efc90273e4daab933a885e47622 Mon Sep 17 00:00:00 2001
From: "Chao Li (HighGo Inc.)" <li.evan.chao@gmail.com>
Date: Thu, 31 Jul 2025 17:02:32 +0800
Subject: [PATCH v7] Add support for dumping raw parse tree with
debug_print_raw_parse
This patch introduces a small change to log the raw parse tree in the
same way we currently log the parse tree, rewritten tree, and plan tree.
While tracing some queries, I found that being able to inspect the raw
parse tree is also helpful for understanding query transformation.
Although the raw parse tree can be inspected via a debugger, having it
logged simplifies the workflow for those interested in this stage of
query processing, without requiring a debugging session.
To avoid unnecessary log noise for users not interested in this detail,
a new GUC option, "debug_print_raw_parse", has been added.
When starting the PostgreSQL process with "-d N", and N is 3 or higher,
debug_print_raw_parse is enabled automatically, alongside
debug_print_parse.
Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/CAEoWx2mcO0Gpo4vd8kPMAFWeJLSp0MeUUnaLdE1x0tSVd-VzUw%40mail.gmail.com
---
doc/src/sgml/config.sgml | 12 +++++++++---
doc/src/sgml/rules.sgml | 1 +
src/backend/tcop/postgres.c | 7 +++++++
src/backend/utils/misc/guc_parameters.dat | 6 ++++++
src/backend/utils/misc/guc_tables.c | 1 +
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/include/utils/guc.h | 1 +
7 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 0a4b3e55ba5..2a3685f474a 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7383,6 +7383,11 @@ local0.* /var/log/postgresql
</varlistentry>
<varlistentry id="guc-debug-print-parse">
+ <term><varname>debug_print_raw_parse</varname> (<type>boolean</type>)
+ <indexterm>
+ <primary><varname>debug_print_raw_parse</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
<term><varname>debug_print_parse</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>debug_print_parse</varname> configuration parameter</primary>
@@ -7401,8 +7406,8 @@ local0.* /var/log/postgresql
<listitem>
<para>
These parameters enable various debugging output to be emitted.
- When set, they print the resulting parse tree, the query rewriter
- output, or the execution plan for each executed query.
+ When set, they print the resulting raw parse tree, the parse tree, the query
+ rewriter output, or the execution plan for each executed query.
These messages are emitted at <literal>LOG</literal> message level, so by
default they will appear in the server log but will not be sent to the
client. You can change that by adjusting
@@ -7422,7 +7427,8 @@ local0.* /var/log/postgresql
<listitem>
<para>
When set, <varname>debug_pretty_print</varname> indents the messages
- produced by <varname>debug_print_parse</varname>,
+ produced by <varname>debug_print_raw_parse</varname>,
+ <varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. This results in more readable
but much longer output than the <quote>compact</quote> format used when
diff --git a/doc/src/sgml/rules.sgml b/doc/src/sgml/rules.sgml
index 8467d961fd0..282dcd722d4 100644
--- a/doc/src/sgml/rules.sgml
+++ b/doc/src/sgml/rules.sgml
@@ -60,6 +60,7 @@
<acronym>SQL</acronym> statement where the single parts that it is
built from are stored separately. These query trees can be shown
in the server log if you set the configuration parameters
+ <varname>debug_print_raw_parse</varname>,
<varname>debug_print_parse</varname>,
<varname>debug_print_rewritten</varname>, or
<varname>debug_print_plan</varname>. The rule actions are also
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 0cecd464902..d356830f756 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -649,6 +649,10 @@ pg_parse_query(const char *query_string)
TRACE_POSTGRESQL_QUERY_PARSE_DONE(query_string);
+ if (Debug_print_raw_parse)
+ elog_node_display(LOG, "raw parse tree", raw_parsetree_list,
+ Debug_pretty_print);
+
return raw_parsetree_list;
}
@@ -3697,7 +3701,10 @@ set_debug_options(int debug_flag, GucContext context, GucSource source)
if (debug_flag >= 2)
SetConfigOption("log_statement", "all", context, source);
if (debug_flag >= 3)
+ {
+ SetConfigOption("debug_print_raw_parse", "true", context, source);
SetConfigOption("debug_print_parse", "true", context, source);
+ }
if (debug_flag >= 4)
SetConfigOption("debug_print_plan", "true", context, source);
if (debug_flag >= 5)
diff --git a/src/backend/utils/misc/guc_parameters.dat b/src/backend/utils/misc/guc_parameters.dat
index a157cec3c4d..0da01627cfe 100644
--- a/src/backend/utils/misc/guc_parameters.dat
+++ b/src/backend/utils/misc/guc_parameters.dat
@@ -414,6 +414,12 @@
ifdef => 'DEBUG_NODE_TESTS_ENABLED',
},
+{ name => 'debug_print_raw_parse', type => 'bool', context => 'PGC_USERSET', group => 'LOGGING_WHAT',
+ short_desc => 'Logs each query\'s raw parse tree.',
+ variable => 'Debug_print_raw_parse',
+ boot_val => 'false',
+},
+
{ name => 'debug_print_parse', type => 'bool', context => 'PGC_USERSET', group => 'LOGGING_WHAT',
short_desc => 'Logs each query\'s parse tree.',
variable => 'Debug_print_parse',
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 787933a9e5a..00c8376cf4d 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -507,6 +507,7 @@ bool AllowAlterSystem = true;
bool log_duration = false;
bool Debug_print_plan = false;
bool Debug_print_parse = false;
+bool Debug_print_raw_parse = false;
bool Debug_print_rewritten = false;
bool Debug_pretty_print = true;
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index a9d8293474a..26c08693564 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -581,6 +581,7 @@
# - What to Log -
+#debug_print_raw_parse = off
#debug_print_parse = off
#debug_print_rewritten = off
#debug_print_plan = off
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index 72981053e61..756e80a2c2f 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -247,6 +247,7 @@ typedef enum
/* GUC vars that are actually defined in guc_tables.c, rather than elsewhere */
extern PGDLLIMPORT bool Debug_print_plan;
extern PGDLLIMPORT bool Debug_print_parse;
+extern PGDLLIMPORT bool Debug_print_raw_parse;
extern PGDLLIMPORT bool Debug_print_rewritten;
extern PGDLLIMPORT bool Debug_pretty_print;
--
2.39.5 (Apple Git-154)
Hi,
Hi Tatsuo san,
I just rebased the commit for the GUC change.
On Sep 3, 2025, at 09:57, Tatsuo Ishii <ishii@postgresql.org> wrote:
That's 0.3% difference, definitely noise-level. Ok, I withdraw my
claim and commit the patch without unlikely().I also removed unlikely() in v7.
v7 patch looks good to me. BTW, how do you want to be credited in the
commit message?
Author: Chao Li <lic@highgo.com>
Author: Chao Li <li.evan.chao@gmail.com>
It seems your email is the latter, however you wrote the former in
your patch.
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
On Sep 5, 2025, at 18:06, Tatsuo Ishii <ishii@postgresql.org> wrote:
Hi,
v7 patch looks good to me. BTW, how do you want to be credited in the
commit message?Author: Chao Li <lic@highgo.com <mailto:lic@highgo.com>>
Author: Chao Li <li.evan.chao@gmail.com <mailto:li.evan.chao@gmail.com>>It seems your email is the latter, however you wrote the former in
your patch.
Please use the former one that is my company email address. Because it doesn’t work very well with the Mail Archive, so I use my personal Gmail for daily community communication.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
v7 patch looks good to me. BTW, how do you want to be credited in the
commit message?Author: Chao Li <lic@highgo.com <mailto:lic@highgo.com>>
Author: Chao Li <li.evan.chao@gmail.com <mailto:li.evan.chao@gmail.com>>It seems your email is the latter, however you wrote the former in
your patch.Please use the former one that is my company email address. Because it doesn’t work very well with the Mail Archive, so I use my personal Gmail for daily community communication.
Okay. I have just pushed v7 patch. Thank you for your work!
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp