|
10 | 10 | * Written by Peter Eisentraut <peter_e@gmx.net>.
|
11 | 11 | *
|
12 | 12 | * IDENTIFICATION
|
13 |
| - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.202 2004/05/07 00:24:58 tgl Exp $ |
| 13 | + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.203 2004/05/07 01:34:08 momjian Exp $ |
14 | 14 | *
|
15 | 15 | *--------------------------------------------------------------------
|
16 | 16 | */
|
@@ -103,6 +103,8 @@ static const char *assign_log_statement(const char *newval, bool doit,
|
103 | 103 | static const char *assign_log_stmtlvl(int *var, const char *newval,
|
104 | 104 | bool doit, GucSource source);
|
105 | 105 | static bool assign_phony_autocommit(bool newval, bool doit, GucSource source);
|
| 106 | +static bool assign_stage_log_stats(bool newval, bool doit, GucSource source); |
| 107 | +static bool assign_log_stats(bool newval, bool doit, GucSource source); |
106 | 108 |
|
107 | 109 |
|
108 | 110 | /*
|
@@ -577,31 +579,31 @@ static struct config_bool ConfigureNamesBool[] =
|
577 | 579 | NULL
|
578 | 580 | },
|
579 | 581 | &log_parser_stats,
|
580 |
| - false, NULL, NULL |
| 582 | + false, assign_stage_log_stats, NULL |
581 | 583 | },
|
582 | 584 | {
|
583 | 585 | {"log_planner_stats", PGC_USERLIMIT, STATS_MONITORING,
|
584 | 586 | gettext_noop("Writes planner performance statistics to the server log."),
|
585 | 587 | NULL
|
586 | 588 | },
|
587 | 589 | &log_planner_stats,
|
588 |
| - false, NULL, NULL |
| 590 | + false, assign_stage_log_stats, NULL |
589 | 591 | },
|
590 | 592 | {
|
591 | 593 | {"log_executor_stats", PGC_USERLIMIT, STATS_MONITORING,
|
592 | 594 | gettext_noop("Writes executor performance statistics to the server log."),
|
593 | 595 | NULL
|
594 | 596 | },
|
595 | 597 | &log_executor_stats,
|
596 |
| - false, NULL, NULL |
| 598 | + false, assign_stage_log_stats, NULL |
597 | 599 | },
|
598 | 600 | {
|
599 | 601 | {"log_statement_stats", PGC_USERLIMIT, STATS_MONITORING,
|
600 | 602 | gettext_noop("Writes cumulative performance statistics to the server log."),
|
601 | 603 | NULL
|
602 | 604 | },
|
603 | 605 | &log_statement_stats,
|
604 |
| - false, NULL, NULL |
| 606 | + false, assign_log_stats, NULL |
605 | 607 | },
|
606 | 608 | #ifdef BTREE_BUILD_STATS
|
607 | 609 | {
|
@@ -4709,4 +4711,45 @@ assign_phony_autocommit(bool newval, bool doit, GucSource source)
|
4709 | 4711 | }
|
4710 | 4712 |
|
4711 | 4713 |
|
| 4714 | +static bool |
| 4715 | +assign_stage_log_stats(bool newval, bool doit, GucSource source) |
| 4716 | +{ |
| 4717 | + if (newval) |
| 4718 | + { |
| 4719 | + if (log_statement_stats) |
| 4720 | + { |
| 4721 | + if (doit) |
| 4722 | + ereport(ERROR, |
| 4723 | + (errcode(ERRCODE_ERROR_IN_ASSIGNMENT), |
| 4724 | + errmsg("Can not enable parameter when \"log_statement_stats\" is true."))); |
| 4725 | + else |
| 4726 | + return false; |
| 4727 | + } |
| 4728 | + return true; |
| 4729 | + } |
| 4730 | + return true; |
| 4731 | +} |
| 4732 | + |
| 4733 | + |
| 4734 | +static bool |
| 4735 | +assign_log_stats(bool newval, bool doit, GucSource source) |
| 4736 | +{ |
| 4737 | + if (newval) |
| 4738 | + { |
| 4739 | + if (log_parser_stats || log_planner_stats || log_executor_stats) |
| 4740 | + { |
| 4741 | + if (doit) |
| 4742 | + ereport(ERROR, |
| 4743 | + (errcode(ERRCODE_ERROR_IN_ASSIGNMENT), |
| 4744 | + errmsg("Can not enable \"log_statement_stats\" when \"log_parser_stats\",\n" |
| 4745 | + "\"log_planner_stats\", or \"log_executor_stats\" is true."))); |
| 4746 | + else |
| 4747 | + return false; |
| 4748 | + } |
| 4749 | + return true; |
| 4750 | + } |
| 4751 | + return true; |
| 4752 | +} |
| 4753 | + |
| 4754 | + |
4712 | 4755 | #include "guc-file.c"
|
0 commit comments