summaryrefslogtreecommitdiff
path: root/src/timezone
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-07-26 13:07:08 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2019-07-26 13:07:08 -0400
commit8ab66081ca496fd74c406e435e20f4264881a02d (patch)
tree0a3f795b08876d9acb32f842deb52980a0832fa8 /src/timezone
parent3754113f33651965d92aaad6f393757ac0cf8333 (diff)
downloadpostgresql-8ab66081ca496fd74c406e435e20f4264881a02d.tar.gz
Tweak our special-case logic for the IANA "Factory" timezone.
pg_timezone_names() tries to avoid showing the "Factory" zone in the view, mainly because that has traditionally had a very long "abbreviation" such as "Local time zone must be set--see zic manual page", so that showing it messes up psql's formatting of the whole view. Since tzdb version 2016g, IANA instead uses the abbreviation "-00", which is sane enough that there's no reason to discriminate against it. On the other hand, it emerges that FreeBSD and possibly other packagers are so wedded to backwards compatibility that they hack the IANA data to keep the old spelling --- and not just that old spelling, but even older spellings that IANA used back in the stone age. This caused the filter logic to fail to suppress "Factory" at all on such platforms, though the formatting problem is definitely real in that case. To solve both problems, get rid of the hard-wired assumption about exactly what Factory's abbreviation is, and instead reject abbreviations exceeding 31 characters. This will allow Factory to appear in the view if and only if it's using the modern abbreviation. In passing, simplify the code we add to zic.c to support "zic -P" to remove its now-obsolete hacks to not print the Factory zone's abbreviation. Unlike pg_timezone_names(), there's no reason for that code to support old/nonstandard timezone data. Since we generally prefer to keep timezone-related behavior the same in all branches, and since this is arguably a bug fix, back-patch to all supported branches. Discussion: https://postgr.es/m/3961.1564086915@sss.pgh.pa.us
Diffstat (limited to 'src/timezone')
-rw-r--r--src/timezone/zic.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index 95ab854712..c27fb456d0 100644
--- a/src/timezone/zic.c
+++ b/src/timezone/zic.c
@@ -2443,13 +2443,10 @@ writezone(const char *const name, const char *const string, char version,
unsigned char tm = types[i];
char *thisabbrev = &thischars[indmap[desigidx[tm]]];
- /* filter out assorted junk entries */
- if (strcmp(thisabbrev, GRANDPARENTED) != 0 &&
- strcmp(thisabbrev, "zzz") != 0)
- fprintf(stdout, "%s\t" INT64_FORMAT "%s\n",
- thisabbrev,
- utoffs[tm],
- isdsts[tm] ? "\tD" : "");
+ fprintf(stdout, "%s\t" INT64_FORMAT "%s\n",
+ thisabbrev,
+ utoffs[tm],
+ isdsts[tm] ? "\tD" : "");
}
}
/* Print the default type if we have no transitions at all */
@@ -2458,13 +2455,10 @@ writezone(const char *const name, const char *const string, char version,
unsigned char tm = defaulttype;
char *thisabbrev = &thischars[indmap[desigidx[tm]]];
- /* filter out assorted junk entries */
- if (strcmp(thisabbrev, GRANDPARENTED) != 0 &&
- strcmp(thisabbrev, "zzz") != 0)
- fprintf(stdout, "%s\t" INT64_FORMAT "%s\n",
- thisabbrev,
- utoffs[tm],
- isdsts[tm] ? "\tD" : "");
+ fprintf(stdout, "%s\t" INT64_FORMAT "%s\n",
+ thisabbrev,
+ utoffs[tm],
+ isdsts[tm] ? "\tD" : "");
}
}