Skip to content

Commit 0925e4a

Browse files
committed
Merge branch 'REL9_6_STABLE' into PGPRO9_6
2 parents 671a752 + 512c197 commit 0925e4a

File tree

19 files changed

+273
-116
lines changed

19 files changed

+273
-116
lines changed

doc/src/sgml/catalogs.sgml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9819,6 +9819,13 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
98199819
</tgroup>
98209820
</table>
98219821

9822+
<para>
9823+
While most timezone abbreviations represent fixed offsets from UTC,
9824+
there are some that have historically varied in value
9825+
(see <xref linkend="datetime-config-files"> for more information).
9826+
In such cases this view presents their current meaning.
9827+
</para>
9828+
98229829
</sect1>
98239830

98249831
<sect1 id="view-pg-timezone-names">

doc/src/sgml/datetime.sgml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -384,19 +384,38 @@
384384

385385
<para>
386386
A <replaceable>zone_abbreviation</replaceable> is just the abbreviation
387-
being defined. The <replaceable>offset</replaceable> is the equivalent
388-
offset in seconds from UTC, positive being east from Greenwich and
389-
negative being west. For example, -18000 would be five hours west
390-
of Greenwich, or North American east coast standard time. <literal>D</>
391-
indicates that the zone name represents local daylight-savings time rather
392-
than standard time. Alternatively, a <replaceable>time_zone_name</> can
393-
be given, in which case that time zone definition is consulted, and the
394-
abbreviation's meaning in that zone is used. This alternative is
395-
recommended only for abbreviations whose meaning has historically varied,
396-
as looking up the meaning is noticeably more expensive than just using
397-
a fixed integer value.
387+
being defined. An <replaceable>offset</replaceable> is an integer giving
388+
the equivalent offset in seconds from UTC, positive being east from
389+
Greenwich and negative being west. For example, -18000 would be five
390+
hours west of Greenwich, or North American east coast standard time.
391+
<literal>D</> indicates that the zone name represents local
392+
daylight-savings time rather than standard time.
398393
</para>
399394

395+
<para>
396+
Alternatively, a <replaceable>time_zone_name</> can be given, referencing
397+
a zone name defined in the IANA timezone database. The zone's definition
398+
is consulted to see whether the abbreviation is or has been in use in
399+
that zone, and if so, the appropriate meaning is used &mdash; that is,
400+
the meaning that was currently in use at the timestamp whose value is
401+
being determined, or the meaning in use immediately before that if it
402+
wasn't current at that time, or the oldest meaning if it was used only
403+
after that time. This behavior is essential for dealing with
404+
abbreviations whose meaning has historically varied. It is also allowed
405+
to define an abbreviation in terms of a zone name in which that
406+
abbreviation does not appear; then using the abbreviation is just
407+
equivalent to writing out the zone name.
408+
</para>
409+
410+
<tip>
411+
<para>
412+
Using a simple integer <replaceable>offset</replaceable> is preferred
413+
when defining an abbreviation whose offset from UTC has never changed,
414+
as such abbreviations are much cheaper to process than those that
415+
require consulting a time zone definition.
416+
</para>
417+
</tip>
418+
400419
<para>
401420
The <literal>@INCLUDE</> syntax allows inclusion of another file in the
402421
<filename>.../share/timezonesets/</> directory. Inclusion can be nested,

doc/src/sgml/logicaldecoding.sgml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
<para>
1414
Changes are sent out in streams identified by logical replication slots.
15-
Each stream outputs each change exactly once.
1615
</para>
1716

1817
<para>
@@ -204,8 +203,7 @@ $ pg_recvlogical -d postgres --slot test --drop-slot
204203
In the context of logical replication, a slot represents a stream of
205204
changes that can be replayed to a client in the order they were made on
206205
the origin server. Each slot streams a sequence of changes from a single
207-
database, sending each change exactly once (except when peeking forward
208-
in the stream).
206+
database.
209207
</para>
210208

211209
<note>
@@ -221,6 +219,20 @@ $ pg_recvlogical -d postgres --slot test --drop-slot
221219
independently of the connection using them and are crash-safe.
222220
</para>
223221

222+
<para>
223+
A logical slot will emit each change just once in normal operation.
224+
The current position of each slot is persisted only at checkpoint, so in
225+
the case of a crash the slot may return to an earlier LSN, which will
226+
then cause recent changes to be resent when the server restarts.
227+
Logical decoding clients are responsible for avoiding ill effects from
228+
handling the same message more than once. Clients may wish to record
229+
the last LSN they saw when decoding and skip over any repeated data or
230+
(when using the replication protocol) request that decoding start from
231+
that LSN rather than letting the server determine the start point.
232+
The Replication Progress Tracking feature is designed for this purpose,
233+
refer to <link linkend="replication-origins">replication origins</link>.
234+
</para>
235+
224236
<para>
225237
Multiple independent slots may exist for a single database. Each slot has
226238
its own state, allowing different consumers to receive changes from

doc/src/sgml/release-9.6.sgml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,26 @@ This commit is also listed under libpq and psql
303303
</para>
304304
</listitem>
305305

306+
<listitem>
307+
<!--
308+
2016-06-07 [a89b4b1be] Update citext extension for parallel query.
309+
and many others in the same vein
310+
-->
311+
<para>
312+
Update extension functions to be marked parallel-safe where
313+
appropriate (Andreas Karlsson)
314+
</para>
315+
316+
<para>
317+
Many of the standard extensions have been updated to allow their
318+
functions to be executed within parallel query worker processes.
319+
These changes will not take effect in
320+
databases <application>pg_upgrade</>'d from prior versions unless
321+
you apply <command>ALTER EXTENSION UPDATE</> to each such extension
322+
(in each database of a cluster).
323+
</para>
324+
</listitem>
325+
306326
</itemizedlist>
307327

308328
</sect2>

src/backend/access/gin/gindatapage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ typedef struct
8686
char action;
8787

8888
ItemPointerData *modifieditems;
89-
int nmodifieditems;
89+
uint16 nmodifieditems;
9090

9191
/*
9292
* The following fields represent the items in this segment. If 'items' is

src/backend/utils/adt/datetime.c

Lines changed: 64 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ static void AdjustFractDays(double frac, struct pg_tm * tm, fsec_t *fsec,
5656
int scale);
5757
static int DetermineTimeZoneOffsetInternal(struct pg_tm * tm, pg_tz *tzp,
5858
pg_time_t *tp);
59-
static int DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t, const char *abbr,
60-
pg_tz *tzp, int *isdst);
59+
static bool DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t,
60+
const char *abbr, pg_tz *tzp,
61+
int *offset, int *isdst);
6162
static pg_tz *FetchDynamicTimeZone(TimeZoneAbbrevTable *tbl, const datetkn *tp);
6263

6364

@@ -1689,19 +1690,40 @@ DetermineTimeZoneOffsetInternal(struct pg_tm * tm, pg_tz *tzp, pg_time_t *tp)
16891690
* This differs from the behavior of DetermineTimeZoneOffset() in that a
16901691
* standard-time or daylight-time abbreviation forces use of the corresponding
16911692
* GMT offset even when the zone was then in DS or standard time respectively.
1693+
* (However, that happens only if we can match the given abbreviation to some
1694+
* abbreviation that appears in the IANA timezone data. Otherwise, we fall
1695+
* back to doing DetermineTimeZoneOffset().)
16921696
*/
16931697
int
16941698
DetermineTimeZoneAbbrevOffset(struct pg_tm * tm, const char *abbr, pg_tz *tzp)
16951699
{
16961700
pg_time_t t;
1701+
int zone_offset;
1702+
int abbr_offset;
1703+
int abbr_isdst;
16971704

16981705
/*
16991706
* Compute the UTC time we want to probe at. (In event of overflow, we'll
17001707
* probe at the epoch, which is a bit random but probably doesn't matter.)
17011708
*/
1702-
(void) DetermineTimeZoneOffsetInternal(tm, tzp, &t);
1709+
zone_offset = DetermineTimeZoneOffsetInternal(tm, tzp, &t);
17031710

1704-
return DetermineTimeZoneAbbrevOffsetInternal(t, abbr, tzp, &tm->tm_isdst);
1711+
/*
1712+
* Try to match the abbreviation to something in the zone definition.
1713+
*/
1714+
if (DetermineTimeZoneAbbrevOffsetInternal(t, abbr, tzp,
1715+
&abbr_offset, &abbr_isdst))
1716+
{
1717+
/* Success, so use the abbrev-specific answers. */
1718+
tm->tm_isdst = abbr_isdst;
1719+
return abbr_offset;
1720+
}
1721+
1722+
/*
1723+
* No match, so use the answers we already got from
1724+
* DetermineTimeZoneOffsetInternal.
1725+
*/
1726+
return zone_offset;
17051727
}
17061728

17071729

@@ -1715,19 +1737,41 @@ DetermineTimeZoneAbbrevOffsetTS(TimestampTz ts, const char *abbr,
17151737
pg_tz *tzp, int *isdst)
17161738
{
17171739
pg_time_t t = timestamptz_to_time_t(ts);
1740+
int zone_offset;
1741+
int abbr_offset;
1742+
int tz;
1743+
struct pg_tm tm;
1744+
fsec_t fsec;
17181745

1719-
return DetermineTimeZoneAbbrevOffsetInternal(t, abbr, tzp, isdst);
1746+
/*
1747+
* If the abbrev matches anything in the zone data, this is pretty easy.
1748+
*/
1749+
if (DetermineTimeZoneAbbrevOffsetInternal(t, abbr, tzp,
1750+
&abbr_offset, isdst))
1751+
return abbr_offset;
1752+
1753+
/*
1754+
* Else, break down the timestamp so we can use DetermineTimeZoneOffset.
1755+
*/
1756+
if (timestamp2tm(ts, &tz, &tm, &fsec, NULL, tzp) != 0)
1757+
ereport(ERROR,
1758+
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
1759+
errmsg("timestamp out of range")));
1760+
1761+
zone_offset = DetermineTimeZoneOffset(&tm, tzp);
1762+
*isdst = tm.tm_isdst;
1763+
return zone_offset;
17201764
}
17211765

17221766

17231767
/* DetermineTimeZoneAbbrevOffsetInternal()
17241768
*
17251769
* Workhorse for above two functions: work from a pg_time_t probe instant.
1726-
* DST status is returned into *isdst.
1770+
* On success, return GMT offset and DST status into *offset and *isdst.
17271771
*/
1728-
static int
1729-
DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t, const char *abbr,
1730-
pg_tz *tzp, int *isdst)
1772+
static bool
1773+
DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t, const char *abbr, pg_tz *tzp,
1774+
int *offset, int *isdst)
17311775
{
17321776
char upabbr[TZ_STRLEN_MAX + 1];
17331777
unsigned char *p;
@@ -1739,18 +1783,17 @@ DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t, const char *abbr,
17391783
*p = pg_toupper(*p);
17401784

17411785
/* Look up the abbrev's meaning at this time in this zone */
1742-
if (!pg_interpret_timezone_abbrev(upabbr,
1743-
&t,
1744-
&gmtoff,
1745-
isdst,
1746-
tzp))
1747-
ereport(ERROR,
1748-
(errcode(ERRCODE_CONFIG_FILE_ERROR),
1749-
errmsg("time zone abbreviation \"%s\" is not used in time zone \"%s\"",
1750-
abbr, pg_get_timezone_name(tzp))));
1751-
1752-
/* Change sign to agree with DetermineTimeZoneOffset() */
1753-
return (int) -gmtoff;
1786+
if (pg_interpret_timezone_abbrev(upabbr,
1787+
&t,
1788+
&gmtoff,
1789+
isdst,
1790+
tzp))
1791+
{
1792+
/* Change sign to agree with DetermineTimeZoneOffset() */
1793+
*offset = (int) -gmtoff;
1794+
return true;
1795+
}
1796+
return false;
17541797
}
17551798

17561799

src/test/regress/expected/timestamptz.out

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2603,3 +2603,38 @@ SELECT '2007-12-09 07:30:00 UTC'::timestamptz AT TIME ZONE 'VET';
26032603
Sun Dec 09 03:00:00 2007
26042604
(1 row)
26052605

2606+
--
2607+
-- Test that the pg_timezone_names and pg_timezone_abbrevs views are
2608+
-- more-or-less working. We can't test their contents in any great detail
2609+
-- without the outputs changing anytime IANA updates the underlying data,
2610+
-- but it seems reasonable to expect at least one entry per major meridian.
2611+
-- (At the time of writing, the actual counts are around 38 because of
2612+
-- zones using fractional GMT offsets, so this is a pretty loose test.)
2613+
--
2614+
select count(distinct utc_offset) >= 24 as ok from pg_timezone_names;
2615+
ok
2616+
----
2617+
t
2618+
(1 row)
2619+
2620+
select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs;
2621+
ok
2622+
----
2623+
t
2624+
(1 row)
2625+
2626+
-- Let's check the non-default timezone abbreviation sets, too
2627+
set timezone_abbreviations = 'Australia';
2628+
select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs;
2629+
ok
2630+
----
2631+
t
2632+
(1 row)
2633+
2634+
set timezone_abbreviations = 'India';
2635+
select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs;
2636+
ok
2637+
----
2638+
t
2639+
(1 row)
2640+

src/test/regress/sql/timestamptz.sql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,3 +468,19 @@ SELECT '2007-12-09 07:00:00 UTC'::timestamptz AT TIME ZONE 'VET';
468468
SELECT '2007-12-09 07:00:01 UTC'::timestamptz AT TIME ZONE 'VET';
469469
SELECT '2007-12-09 07:29:59 UTC'::timestamptz AT TIME ZONE 'VET';
470470
SELECT '2007-12-09 07:30:00 UTC'::timestamptz AT TIME ZONE 'VET';
471+
472+
--
473+
-- Test that the pg_timezone_names and pg_timezone_abbrevs views are
474+
-- more-or-less working. We can't test their contents in any great detail
475+
-- without the outputs changing anytime IANA updates the underlying data,
476+
-- but it seems reasonable to expect at least one entry per major meridian.
477+
-- (At the time of writing, the actual counts are around 38 because of
478+
-- zones using fractional GMT offsets, so this is a pretty loose test.)
479+
--
480+
select count(distinct utc_offset) >= 24 as ok from pg_timezone_names;
481+
select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs;
482+
-- Let's check the non-default timezone abbreviation sets, too
483+
set timezone_abbreviations = 'Australia';
484+
select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs;
485+
set timezone_abbreviations = 'India';
486+
select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs;

src/timezone/README

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ in the same commit. Usually, if a known abbreviation has changed meaning,
3434
the appropriate fix is to make it refer to a long-form zone name instead
3535
of a fixed GMT offset.
3636

37+
The core regression test suite does some simple validation of the zone
38+
data and abbreviations data (notably by checking that the pg_timezone_names
39+
and pg_timezone_abbrevs views don't throw errors). It's worth running it
40+
as a cross-check on proposed updates.
41+
3742
When there has been a new release of Windows (probably including Service
3843
Packs), the list of matching timezones need to be updated. Run the
3944
script in src/tools/win32tzlist.pl on a Windows machine running this new

src/timezone/tznames/Africa.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ GMT 0 # Greenwich Mean Time
144144
# (Europe/London)
145145
# CONFLICT! SAST is not unique
146146
# Other timezones:
147-
# - SAST South Australian Standard Time (not in zic)
147+
# - SAST South Australian Standard Time (not in IANA database)
148148
SAST 7200 # South Africa Standard Time
149149
# (Africa/Johannesburg)
150150
WAST 7200 D # West Africa Summer Time

0 commit comments

Comments
 (0)