mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Revise the API for GUC variable assign hooks.
The previous functions of assign hooks are now split between check hooks and assign hooks, where the former can fail but the latter shouldn't. Aside from being conceptually clearer, this approach exposes the "canonicalized" form of the variable value to guc.c without having to do an actual assignment. And that lets us fix the problem recently noted by Bernd Helmle that the auto-tune patch for wal_buffers resulted in bogus log messages about "parameter "wal_buffers" cannot be changed without restarting the server". There may be some speed advantage too, because this design lets hook functions avoid re-parsing variable values when restoring a previous state after a rollback (they can store a pre-parsed representation of the value instead). This patch also resolves a longstanding annoyance about custom error messages from variable assign hooks: they should modify, not appear separately from, guc.c's own message about "invalid parameter value".
This commit is contained in:
@ -200,6 +200,15 @@ elog_finish(int elevel, const char *fmt,...)
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
|
||||
|
||||
/* Support for constructing error strings separately from ereport() calls */
|
||||
|
||||
extern void pre_format_elog_string(int errnumber, const char *domain);
|
||||
extern char *format_elog_string(const char *fmt,...)
|
||||
/* This extension allows gcc to check the format string for consistency with
|
||||
the supplied arguments. */
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
|
||||
|
||||
/* Support for attaching context information to error reports */
|
||||
|
||||
typedef struct ErrorContextCallback
|
||||
|
Reference in New Issue
Block a user