From: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
---|---|
To: | Peter Smith <smithpb2250(at)gmail(dot)com> |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: GUC values - recommended way to declare the C variables? |
Date: | 2022-10-25 20:04:01 |
Message-ID: | 20221025200401.GO16921@telsasoft.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
+#ifdef USE_ASSERT_CHECKING
+ sanity_check_GUC_C_var(hentry->gucvar);
+#endif
=> You can conditionally define that as an empty function so #ifdefs
aren't needed in the caller:
void sanity_check_GUC_C_var()
{
#ifdef USE_ASSERT_CHECKING
...
#endif
}
+ /* Skip checking for dynamic (compiler-dependent) GUCs. */
=> This should say that the GUC's default is determined at compile-time.
But actually, I don't think you should use my patch. You needed to
exclude update_process_title:
src/backend/utils/misc/ps_status.c:bool update_process_title = true;
...
src/backend/utils/misc/guc_tables.c-#ifdef WIN32
src/backend/utils/misc/guc_tables.c- false,
src/backend/utils/misc/guc_tables.c-#else
src/backend/utils/misc/guc_tables.c- true,
src/backend/utils/misc/guc_tables.c-#endif
src/backend/utils/misc/guc_tables.c- NULL, NULL, NULL
My patch would also exclude the 16 other GUCs with compile-time defaults
from your check. It'd be better not to exclude them; I think the right
solution is to change the C variable initialization to a compile-time
constant:
#ifdef WIN32
bool update_process_title = false;
#else
bool update_process_title = true;
#endif
Or something more indirect like:
#ifdef WIN32
#define DEFAULT_PROCESS_TITLE false
#else
#define DEFAULT_PROCESS_TITLE true
#endif
bool update_process_title = DEFAULT_PROCESS_TITLE;
I suspect there's not many GUCs that would need to change - this might
be the only one. If this GUC were defined in the inverse (bool
skip_process_title), it wouldn't need special help, either.
--
Justin
From | Date | Subject | |
---|---|---|---|
Next Message | Jacob Champion | 2022-10-25 20:17:05 | Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert |
Previous Message | Heikki Linnakangas | 2022-10-25 19:44:46 | Re: Confused about TransactionIdSetTreeStatus |