diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index ca0e6c93bdc..dc27b155683 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4854,16 +4854,15 @@ pg_timezone_names(PG_FUNCTION_ARGS)
 			continue;			/* ignore if conversion fails */
 
 		/*
-		 * Ignore zic's rather silly "Factory" time zone.  The long string
-		 * about "see zic manual page" is used in tzdata versions before
-		 * 2016g; we can drop it someday when we're pretty sure no such data
-		 * exists in the wild on platforms using --with-system-tzdata.  In
-		 * 2016g and later, the time zone abbreviation "-00" is used for
-		 * "Factory" as well as some invalid cases, all of which we can
-		 * reasonably omit from the pg_timezone_names view.
+		 * IANA's rather silly "Factory" time zone used to emit ridiculously
+		 * long "abbreviations" such as "Local time zone must be set--see zic
+		 * manual page" or "Local time zone must be set--use tzsetup".  While
+		 * modern versions of tzdb emit the much saner "-00", it seems some
+		 * benighted packagers are hacking the IANA data so that it continues
+		 * to produce these strings.  To prevent producing a weirdly wide
+		 * abbrev column, reject ridiculously long abbreviations.
 		 */
-		if (tzn && (strcmp(tzn, "-00") == 0 ||
-					strcmp(tzn, "Local time zone must be set--see zic manual page") == 0))
+		if (tzn && strlen(tzn) > 31)
 			continue;
 
 		/* Found a displayable zone */
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index f7bbe41c524..6eae8713915 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" : "");
 			}
 		}