diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-04-07 00:11:01 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-04-07 00:12:02 -0400 |
commit | 2594cf0e8c04406ffff19b1651c5a406d376657c (patch) | |
tree | 8ced737d26b54f4499a8029d8cad0ab42fc83ba3 /src/include/utils/datetime.h | |
parent | 5d0e462366f4521e37744fdb42fed3c6819a3374 (diff) |
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".
Diffstat (limited to 'src/include/utils/datetime.h')
-rw-r--r-- | src/include/utils/datetime.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h index 11672458f4c..9911d207936 100644 --- a/src/include/utils/datetime.h +++ b/src/include/utils/datetime.h @@ -20,7 +20,9 @@ #include <math.h> #include "utils/timestamp.h" -#include "utils/tzparser.h" + +/* this struct is declared in utils/tzparser.h: */ +struct tzEntry; /* ---------------------------------------------------------------- @@ -203,6 +205,13 @@ typedef struct char value; /* this may be unsigned, alas */ } datetkn; +/* one of its uses is in tables of time zone abbreviations */ +typedef struct TimeZoneAbbrevTable +{ + int numabbrevs; + datetkn abbrevs[1]; /* VARIABLE LENGTH ARRAY */ +} TimeZoneAbbrevTable; + /* FMODULO() * Macro to replace modf(), which is broken on some platforms. @@ -317,7 +326,10 @@ extern int DecodeUnits(int field, char *lowtoken, int *val); extern int j2day(int jd); extern bool CheckDateTokenTables(void); -extern void InstallTimeZoneAbbrevs(tzEntry *abbrevs, int n); + +extern void ConvertTimeZoneAbbrevs(TimeZoneAbbrevTable *tbl, + struct tzEntry *abbrevs, int n); +extern void InstallTimeZoneAbbrevs(TimeZoneAbbrevTable *tbl); extern Datum pg_timezone_abbrevs(PG_FUNCTION_ARGS); extern Datum pg_timezone_names(PG_FUNCTION_ARGS); |