Skip to content

Commit 42e1017

Browse files
committed
Merge branch 'REL9_5_STABLE' into PGPRO9_5
2 parents 9ad3ab9 + 2f38b3e commit 42e1017

File tree

9 files changed

+330
-9
lines changed

9 files changed

+330
-9
lines changed

contrib/test_decoding/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ isolationcheck-install-force: all | submake-isolation submake-test_decoding temp
6565
$(pg_isolation_regress_installcheck) \
6666
$(ISOLATIONCHECKS)
6767

68-
PHONY: submake-test_decoding submake-regress check \
68+
.PHONY: submake-test_decoding submake-regress check \
6969
regresscheck regresscheck-install-force \
7070
isolationcheck isolationcheck-install-force
7171

doc/src/sgml/brin.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
tuple; those tuples remain unsummarized until a summarization run is
7575
invoked later, creating initial summaries.
7676
This process can be invoked manually using the
77-
<function>brin_summarize_new_pages(regclass)</function> function,
77+
<function>brin_summarize_new_values(regclass)</function> function,
7878
or automatically when <command>VACUUM</command> processes the table.
7979
</para>
8080
</sect2>

src/backend/commands/policy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
10811081
if (!attr_isnull)
10821082
{
10831083
char *qual_value;
1084-
ParseState *qual_pstate = make_parsestate(NULL);
1084+
ParseState *qual_pstate;
10851085

10861086
/* parsestate is built just to build the range table */
10871087
qual_pstate = make_parsestate(NULL);
@@ -1122,7 +1122,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
11221122
if (!attr_isnull)
11231123
{
11241124
char *with_check_value;
1125-
ParseState *with_check_pstate = make_parsestate(NULL);
1125+
ParseState *with_check_pstate;
11261126

11271127
/* parsestate is built just to build the range table */
11281128
with_check_pstate = make_parsestate(NULL);

src/backend/utils/Gen_dummy_probes.pl

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
#! /usr/bin/perl -w
2+
#-------------------------------------------------------------------------
3+
#
4+
# Gen_dummy_probes.pl
5+
# Perl script that generates probes.h file when dtrace is not available
6+
#
7+
# Portions Copyright (c) 2008-2016, PostgreSQL Global Development Group
8+
#
9+
#
10+
# IDENTIFICATION
11+
# src/backend/utils/Gen_dummy_probes.pl
12+
#
13+
# This program was generated by running perl's s2p over Gen_dummy_probes.sed
14+
#
15+
#-------------------------------------------------------------------------
16+
17+
$0 =~ s/^.*?(\w+)[\.\w+]*$/$1/;
18+
19+
use strict;
20+
use Symbol;
21+
use vars qw{ $isEOF $Hold %wFiles @Q $CondReg
22+
$doAutoPrint $doOpenWrite $doPrint };
23+
$doAutoPrint = 1;
24+
$doOpenWrite = 1;
25+
26+
# prototypes
27+
sub openARGV();
28+
sub getsARGV(;\$);
29+
sub eofARGV();
30+
sub printQ();
31+
32+
# Run: the sed loop reading input and applying the script
33+
#
34+
sub Run()
35+
{
36+
my ($h, $icnt, $s, $n);
37+
38+
# hack (not unbreakable :-/) to avoid // matching an empty string
39+
my $z = "\000";
40+
$z =~ /$z/;
41+
42+
# Initialize.
43+
openARGV();
44+
$Hold = '';
45+
$CondReg = 0;
46+
$doPrint = $doAutoPrint;
47+
CYCLE:
48+
while (getsARGV())
49+
{
50+
chomp();
51+
$CondReg = 0; # cleared on t
52+
BOS:;
53+
54+
# /^[ ]*probe /!d
55+
unless (m /^[ \t]*probe /s)
56+
{
57+
$doPrint = 0;
58+
goto EOS;
59+
}
60+
61+
# s/^[ ]*probe \([^(]*\)\(.*\);/\1\2/
62+
{
63+
$s = s /^[ \t]*probe ([^(]*)(.*);/${1}${2}/s;
64+
$CondReg ||= $s;
65+
}
66+
67+
# s/__/_/g
68+
{
69+
$s = s /__/_/sg;
70+
$CondReg ||= $s;
71+
}
72+
73+
# y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
74+
{ y{abcdefghijklmnopqrstuvwxyz}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}; }
75+
76+
# s/^/#define TRACE_POSTGRESQL_/
77+
{
78+
$s = s /^/#define TRACE_POSTGRESQL_/s;
79+
$CondReg ||= $s;
80+
}
81+
82+
# s/([^,)]\{1,\})/(INT1)/
83+
{
84+
$s = s /\([^,)]+\)/(INT1)/s;
85+
$CondReg ||= $s;
86+
}
87+
88+
# s/([^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2)/
89+
{
90+
$s = s /\([^,)]+, [^,)]+\)/(INT1, INT2)/s;
91+
$CondReg ||= $s;
92+
}
93+
94+
# s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3)/
95+
{
96+
$s = s /\([^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3)/s;
97+
$CondReg ||= $s;
98+
}
99+
100+
# s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4)/
101+
{
102+
$s =
103+
s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4)/s;
104+
$CondReg ||= $s;
105+
}
106+
107+
# s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5)/
108+
{
109+
$s =
110+
s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5)/s;
111+
$CondReg ||= $s;
112+
}
113+
114+
# s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6)/
115+
{
116+
$s =
117+
s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5, INT6)/s;
118+
$CondReg ||= $s;
119+
}
120+
121+
# s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7)/
122+
{
123+
$s =
124+
s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5, INT6, INT7)/s;
125+
$CondReg ||= $s;
126+
}
127+
128+
# s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)/
129+
{
130+
$s =
131+
s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)/s;
132+
$CondReg ||= $s;
133+
}
134+
135+
# P
136+
{
137+
if (/^(.*)/) { print $1, "\n"; }
138+
}
139+
140+
# s/(.*$/_ENABLED() (0)/
141+
{
142+
$s = s /\(.*$/_ENABLED() (0)/s;
143+
$CondReg ||= $s;
144+
}
145+
EOS: if ($doPrint)
146+
{
147+
print $_, "\n";
148+
}
149+
else
150+
{
151+
$doPrint = $doAutoPrint;
152+
}
153+
printQ() if @Q;
154+
}
155+
156+
exit(0);
157+
}
158+
Run();
159+
160+
# openARGV: open 1st input file
161+
#
162+
sub openARGV()
163+
{
164+
unshift(@ARGV, '-') unless @ARGV;
165+
my $file = shift(@ARGV);
166+
open(ARG, "<$file")
167+
|| die("$0: can't open $file for reading ($!)\n");
168+
$isEOF = 0;
169+
}
170+
171+
# getsARGV: Read another input line into argument (default: $_).
172+
# Move on to next input file, and reset EOF flag $isEOF.
173+
sub getsARGV(;\$)
174+
{
175+
my $argref = @_ ? shift() : \$_;
176+
while ($isEOF || !defined($$argref = <ARG>))
177+
{
178+
close(ARG);
179+
return 0 unless @ARGV;
180+
my $file = shift(@ARGV);
181+
open(ARG, "<$file")
182+
|| die("$0: can't open $file for reading ($!)\n");
183+
$isEOF = 0;
184+
}
185+
1;
186+
}
187+
188+
# eofARGV: end-of-file test
189+
#
190+
sub eofARGV()
191+
{
192+
return @ARGV == 0 && ($isEOF = eof(ARG));
193+
}
194+
195+
# makeHandle: Generates another file handle for some file (given by its path)
196+
# to be written due to a w command or an s command's w flag.
197+
sub makeHandle($)
198+
{
199+
my ($path) = @_;
200+
my $handle;
201+
if (!exists($wFiles{$path}) || $wFiles{$path} eq '')
202+
{
203+
$handle = $wFiles{$path} = gensym();
204+
if ($doOpenWrite)
205+
{
206+
if (!open($handle, ">$path"))
207+
{
208+
die("$0: can't open $path for writing: ($!)\n");
209+
}
210+
}
211+
}
212+
else
213+
{
214+
$handle = $wFiles{$path};
215+
}
216+
return $handle;
217+
}
218+
219+
# printQ: Print queued output which is either a string or a reference
220+
# to a pathname.
221+
sub printQ()
222+
{
223+
for my $q (@Q)
224+
{
225+
if (ref($q))
226+
{
227+
# flush open w files so that reading this file gets it all
228+
if (exists($wFiles{$$q}) && $wFiles{$$q} ne '')
229+
{
230+
open($wFiles{$$q}, ">>$$q");
231+
}
232+
233+
# copy file to stdout: slow, but safe
234+
if (open(RF, "<$$q"))
235+
{
236+
while (defined(my $line = <RF>))
237+
{
238+
print $line;
239+
}
240+
close(RF);
241+
}
242+
}
243+
else
244+
{
245+
print $q;
246+
}
247+
}
248+
undef(@Q);
249+
}

src/backend/utils/adt/formatting.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,11 +2762,15 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
27622762
break;
27632763
case DCH_OF:
27642764
INVALID_FOR_INTERVAL;
2765-
sprintf(s, "%+0*d", S_FM(n->suffix) ? 0 : 3, (int) tm->tm_gmtoff / SECS_PER_HOUR);
2765+
sprintf(s, "%c%0*d",
2766+
(tm->tm_gmtoff >= 0) ? '+' : '-',
2767+
S_FM(n->suffix) ? 0 : 2,
2768+
abs((int) tm->tm_gmtoff) / SECS_PER_HOUR);
27662769
s += strlen(s);
2767-
if ((int) tm->tm_gmtoff % SECS_PER_HOUR != 0)
2770+
if (abs((int) tm->tm_gmtoff) % SECS_PER_HOUR != 0)
27682771
{
2769-
sprintf(s, ":%02d", abs((int) tm->tm_gmtoff % SECS_PER_HOUR) / SECS_PER_MINUTE);
2772+
sprintf(s, ":%02d",
2773+
(abs((int) tm->tm_gmtoff) % SECS_PER_HOUR) / SECS_PER_MINUTE);
27702774
s += strlen(s);
27712775
}
27722776
break;

src/test/modules/brin/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ isolation-check: | submake-isolation
2424
--outputdir=./isolation_output \
2525
$(ISOLATIONCHECKS)
2626

27-
PHONY: check isolation-check
27+
.PHONY: check isolation-check
2828

2929
submake-isolation:
3030
$(MAKE) -C $(top_builddir)/src/test/isolation all

src/test/regress/expected/timestamptz.out

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,57 @@ SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID')
16751675
| 2001 1 1 1 1 1 1
16761676
(66 rows)
16771677

1678+
-- Check OF with various zone offsets, particularly fractional hours
1679+
SET timezone = '00:00';
1680+
SELECT to_char(now(), 'OF');
1681+
to_char
1682+
---------
1683+
+00
1684+
(1 row)
1685+
1686+
SET timezone = '+02:00';
1687+
SELECT to_char(now(), 'OF');
1688+
to_char
1689+
---------
1690+
-02
1691+
(1 row)
1692+
1693+
SET timezone = '-13:00';
1694+
SELECT to_char(now(), 'OF');
1695+
to_char
1696+
---------
1697+
+13
1698+
(1 row)
1699+
1700+
SET timezone = '-00:30';
1701+
SELECT to_char(now(), 'OF');
1702+
to_char
1703+
---------
1704+
+00:30
1705+
(1 row)
1706+
1707+
SET timezone = '00:30';
1708+
SELECT to_char(now(), 'OF');
1709+
to_char
1710+
---------
1711+
-00:30
1712+
(1 row)
1713+
1714+
SET timezone = '-04:30';
1715+
SELECT to_char(now(), 'OF');
1716+
to_char
1717+
---------
1718+
+04:30
1719+
(1 row)
1720+
1721+
SET timezone = '04:30';
1722+
SELECT to_char(now(), 'OF');
1723+
to_char
1724+
---------
1725+
-04:30
1726+
(1 row)
1727+
1728+
RESET timezone;
16781729
CREATE TABLE TIMESTAMPTZ_TST (a int , b timestamptz);
16791730
-- Test year field value with len > 4
16801731
INSERT INTO TIMESTAMPTZ_TST VALUES(1, 'Sat Mar 12 23:58:48 1000 IST');

src/test/regress/sql/timestamptz.sql

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,23 @@ SELECT '' AS to_char_10, to_char(d1, 'IYYY IYY IY I IW IDDD ID')
241241
SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID')
242242
FROM TIMESTAMPTZ_TBL;
243243

244+
-- Check OF with various zone offsets, particularly fractional hours
245+
SET timezone = '00:00';
246+
SELECT to_char(now(), 'OF');
247+
SET timezone = '+02:00';
248+
SELECT to_char(now(), 'OF');
249+
SET timezone = '-13:00';
250+
SELECT to_char(now(), 'OF');
251+
SET timezone = '-00:30';
252+
SELECT to_char(now(), 'OF');
253+
SET timezone = '00:30';
254+
SELECT to_char(now(), 'OF');
255+
SET timezone = '-04:30';
256+
SELECT to_char(now(), 'OF');
257+
SET timezone = '04:30';
258+
SELECT to_char(now(), 'OF');
259+
RESET timezone;
260+
244261
CREATE TABLE TIMESTAMPTZ_TST (a int , b timestamptz);
245262

246263
-- Test year field value with len > 4

0 commit comments

Comments
 (0)