Monday, June 30, 2008

Re: [HACKERS] Remove redundant extra_desc info for enum GUC variables?

Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.457
diff -c -r1.457 guc.c
*** src/backend/utils/misc/guc.c 30 Jun 2008 10:58:47 -0000 1.457
--- src/backend/utils/misc/guc.c 30 Jun 2008 19:50:24 -0000
***************
*** 172,178 ****
/*
* Options for enum values defined in this module.
*/
! static const struct config_enum_entry message_level_options[] = {
{"debug", DEBUG2, false},
{"debug5", DEBUG5, false},
{"debug4", DEBUG4, false},
--- 172,183 ----
/*
* Options for enum values defined in this module.
*/
!
! /*
! * We have different sets for client and server message level options because
! * they sort slightly different (see "log" level)
! */
! static const struct config_enum_entry client_message_level_options[] = {
{"debug", DEBUG2, false},
{"debug5", DEBUG5, false},
{"debug4", DEBUG4, false},
***************
*** 180,189 ****
--- 185,211 ----
{"debug2", DEBUG2, false},
{"debug1", DEBUG1, false},
{"log", LOG, false},
+ {"info", INFO, true},
+ {"notice", NOTICE, false},
+ {"warning", WARNING, false},
+ {"error", ERROR, false},
+ {"fatal", FATAL, true},
+ {"panic", PANIC, true},
+ {NULL, 0, false}
+ };
+
+ static const struct config_enum_entry server_message_level_options[] = {
+ {"debug", DEBUG2, false},
+ {"debug5", DEBUG5, false},
+ {"debug4", DEBUG4, false},
+ {"debug3", DEBUG3, false},
+ {"debug2", DEBUG2, false},
+ {"debug1", DEBUG1, false},
{"info", INFO, false},
{"notice", NOTICE, false},
{"warning", WARNING, false},
{"error", ERROR, false},
+ {"log", LOG, false},
{"fatal", FATAL, false},
{"panic", PANIC, false},
{NULL, 0, false}
***************
*** 2449,2461 ****
{
{"client_min_messages", PGC_USERSET, LOGGING_WHEN,
gettext_noop("Sets the message levels that are sent to the client."),
! gettext_noop("Valid values are DEBUG5, DEBUG4, DEBUG3, DEBUG2, "
! "DEBUG1, LOG, NOTICE, WARNING, and ERROR. Each level includes all the "
! "levels that follow it. The later the level, the fewer messages are "
! "sent.")
},
&client_min_messages,
! NOTICE, message_level_options,NULL, NULL
},

{
--- 2471,2481 ----
{
{"client_min_messages", PGC_USERSET, LOGGING_WHEN,
gettext_noop("Sets the message levels that are sent to the client."),
! gettext_noop("Each level includes all the levels that follow it. The later"
! " the level, the fewer messages are sent.")
},
&client_min_messages,
! NOTICE, client_message_level_options,NULL, NULL
},

{
***************
*** 2480,2491 ****
{
{"log_min_messages", PGC_SUSET, LOGGING_WHEN,
gettext_noop("Sets the message levels that are logged."),
! gettext_noop("Valid values are DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1, "
! "INFO, NOTICE, WARNING, ERROR, LOG, FATAL, and PANIC. Each level "
! "includes all the levels that follow it.")
},
&log_min_messages,
! WARNING, message_level_options, NULL, NULL
},

{
--- 2500,2509 ----
{
{"log_min_messages", PGC_SUSET, LOGGING_WHEN,
gettext_noop("Sets the message levels that are logged."),
! gettext_noop("Each level includes all levels that follow it.")
},
&log_min_messages,
! WARNING, server_message_level_options, NULL, NULL
},

{
***************
*** 2495,2501 ****
"specified level or a higher level are logged.")
},
&log_min_error_statement,
! ERROR, message_level_options, NULL, NULL
},

{
--- 2513,2519 ----
"specified level or a higher level are logged.")
},
&log_min_error_statement,
! ERROR, server_message_level_options, NULL, NULL
},

{
Tom Lane wrote:
> Magnus Hagander <magnus@hagander.net> writes:
>> Tom Lane wrote:
>>> Yeah: LOG level sorts differently in the two cases; it's fairly high
>>> priority for server log output and much lower for client output.
>
>> Ok, easy fix if we break them apart. Should we continue to accept
>> values that we're not going to care about, or should I change that at
>> the same time? (for example, client_min_messages doesn't use INFO,
>> but we do accept that in <= 8.3 anyway)
>
> I'd be inclined to keep the actual behavior the same as it was.
> We didn't document INFO for this variable, perhaps, but it's accepted
> and has a well-defined behavior.

Sorry for not getting back to this one sooner, it ended up in the wrong
end of the queue.

Does this patch look like what you meant? It should split them apart,
and it also hides the undocumented levels, but still accept it (now that
we have the ability to hide GUC vars)

//Magnus

No comments: