Suppress leap-second-aware timezones in the output of pg_tzenumerate_next,
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 13 Nov 2008 20:49:38 +0000 (20:49 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 13 Nov 2008 20:49:38 +0000 (20:49 +0000)
and thereby in the pg_timezone_names view.  Although we allow such zones
to be used in certain limited contexts like AT TIME ZONE, we don't allow
them in SET TIME ZONE, and bug #4528 shows that they're more likely to
confuse users than do anything useful.  So hide 'em.  (Note that we don't
even generate these zones when installing our own timezone database.
But they are likely to be present when using a system-provided database.)

src/timezone/pgtz.c

index bdd2250667229fa326f258e855b70827c80eb357..0e23c189b37d70dc5a4430f8818fd0e417adf433 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.60 2008/07/01 03:40:55 tgl Exp $
+ *       $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.61 2008/11/13 20:49:38 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1499,6 +1499,12 @@ pg_tzenumerate_next(pg_tzenum *dir)
                        continue;
                }
 
+               if (!tz_acceptable(&dir->tz))
+               {
+                       /* Ignore leap-second zones */
+                       continue;
+               }
+
                /* Timezone loaded OK. */
                return &dir->tz;
        }