Skip to content

Commit 8c4bd45

Browse files
committed
Merge branch 'PGPRO9_6' into PGPROEE9_6
2 parents 2c1f08d + 7d6a2bc commit 8c4bd45

File tree

13 files changed

+226
-17
lines changed

13 files changed

+226
-17
lines changed

doc/src/sgml/install-windows.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ $ENV{PATH}=$ENV{PATH} . ';c:\some\where\bison\bin';
161161
<productname>Microsoft Windows SDK</productname> it
162162
is recommended that you upgrade to the latest version (currently
163163
version 7.1), available for download from
164-
<ulink url="http://www.microsoft.com/downloads/"></>.
164+
<ulink url="https://www.microsoft.com/download"></>.
165165
</para>
166166
<para>
167167
You must always include the

src/backend/replication/walreceiver.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,15 +1154,19 @@ XLogWalRcvSendReply(bool force, bool requestReply)
11541154
* in case they don't have a watch.
11551155
*
11561156
* If the user disables feedback, send one final message to tell sender
1157-
* to forget about the xmin on this standby.
1157+
* to forget about the xmin on this standby. We also send this message
1158+
* on first connect because a previous connection might have set xmin
1159+
* on a replication slot. (If we're not using a slot it's harmless to
1160+
* send a feedback message explicitly setting InvalidTransactionId).
11581161
*/
11591162
static void
11601163
XLogWalRcvSendHSFeedback(bool immed)
11611164
{
11621165
TimestampTz now;
11631166
TransactionId xmin;
11641167
static TimestampTz sendTime = 0;
1165-
static bool master_has_standby_xmin = false;
1168+
/* initially true so we always send at least one feedback message */
1169+
static bool master_has_standby_xmin = true;
11661170

11671171
/*
11681172
* If the user doesn't want status to be reported to the master, be sure
@@ -1187,14 +1191,17 @@ XLogWalRcvSendHSFeedback(bool immed)
11871191
}
11881192

11891193
/*
1190-
* If Hot Standby is not yet active there is nothing to send. Check this
1191-
* after the interval has expired to reduce number of calls.
1194+
* If Hot Standby is not yet accepting connections there is nothing to
1195+
* send. Check this after the interval has expired to reduce number of
1196+
* calls.
1197+
*
1198+
* Bailing out here also ensures that we don't send feedback until we've
1199+
* read our own replication slot state, so we don't tell the master to
1200+
* discard needed xmin or catalog_xmin from any slots that may exist
1201+
* on this replica.
11921202
*/
11931203
if (!HotStandbyActive())
1194-
{
1195-
Assert(!master_has_standby_xmin);
11961204
return;
1197-
}
11981205

11991206
/*
12001207
* Make the expensive call to get the oldest xmin once we are certain

src/backend/storage/buffer/freelist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ StrategySyncStart(uint32 *complete_passes, uint32 *num_buf_alloc)
406406
/*
407407
* StrategyNotifyBgWriter -- set or clear allocation notification latch
408408
*
409-
* If bgwriterLatch isn't NULL, the next invocation of StrategyGetBuffer will
410-
* set that latch. Pass NULL to clear the pending notification before it
409+
* If bgwprocno isn't -1, the next invocation of StrategyGetBuffer will
410+
* set that latch. Pass -1 to clear the pending notification before it
411411
* happens. This feature is used by the bgwriter process to wake itself up
412412
* from hibernation, and is not meant for anybody else to use.
413413
*/

src/backend/storage/ipc/standby.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ WaitExceedsMaxStandbyDelay(void)
160160
{
161161
TimestampTz ltime;
162162

163+
CHECK_FOR_INTERRUPTS();
164+
163165
/* Are we past the limit time? */
164166
ltime = GetStandbyLimitTime();
165167
if (ltime && GetCurrentTimestamp() >= ltime)

src/backend/tcop/postgres.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ pg_plan_queries(List *querytrees, int cursorOptions, ParamListInfo boundParams)
844844

845845
foreach(query_list, querytrees)
846846
{
847-
Query *query = (Query *) lfirst(query_list);
847+
Query *query = castNode(Query, lfirst(query_list));
848848
Node *stmt;
849849

850850
if (query->commandType == CMD_UTILITY)

src/backend/utils/adt/tsvector_op.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,8 @@ ts_match_vq(PG_FUNCTION_ARGS)
19261926
CHKVAL chkval;
19271927
bool result;
19281928

1929-
if (!val->size || !query->size)
1929+
/* empty query matches nothing */
1930+
if (!query->size)
19301931
{
19311932
PG_FREE_IF_COPY(val, 0);
19321933
PG_FREE_IF_COPY(query, 1);

src/include/nodes/nodes.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,26 @@ extern PGDLLIMPORT Node *newNodeMacroHolder;
543543

544544
#define IsA(nodeptr,_type_) (nodeTag(nodeptr) == T_##_type_)
545545

546+
/*
547+
* castNode(type, ptr) casts ptr to "type *", and if assertions are enabled,
548+
* verifies that the node has the appropriate type (using its nodeTag()).
549+
*
550+
* Use an inline function when assertions are enabled, to avoid multiple
551+
* evaluations of the ptr argument (which could e.g. be a function call).
552+
*/
553+
#ifdef USE_ASSERT_CHECKING
554+
static inline Node *
555+
castNodeImpl(NodeTag type, void *ptr)
556+
{
557+
Assert(ptr == NULL || nodeTag(ptr) == type);
558+
return (Node *) ptr;
559+
}
560+
#define castNode(_type_, nodeptr) ((_type_ *) castNodeImpl(T_##_type_, nodeptr))
561+
#else
562+
#define castNode(_type_, nodeptr) ((_type_ *) (nodeptr))
563+
#endif /* USE_ASSERT_CHECKING */
564+
565+
546566
/* ----------------------------------------------------------------
547567
* extern declarations follow
548568
* ----------------------------------------------------------------

src/test/modules/test_ddl_deparse/expected/comment_on.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@ COMMENT ON TRIGGER trigger_1 ON datatype_table IS 'TRIGGER test';
2121
NOTICE: DDL test: type simple, tag COMMENT
2222
COMMENT ON RULE rule_1 IS 'RULE test';
2323
NOTICE: DDL test: type simple, tag COMMENT
24-
-- should not fire
25-
COMMENT ON DATABASE contrib_regression IS 'contrib regression';

src/test/modules/test_ddl_deparse/sql/comment_on.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,3 @@ COMMENT ON VIEW datatype_view IS 'This is a view';
1212
COMMENT ON FUNCTION c_function_test() IS 'FUNCTION test';
1313
COMMENT ON TRIGGER trigger_1 ON datatype_table IS 'TRIGGER test';
1414
COMMENT ON RULE rule_1 IS 'RULE test';
15-
16-
-- should not fire
17-
COMMENT ON DATABASE contrib_regression IS 'contrib regression';

src/test/regress/expected/tsearch.out

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,108 @@ SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*';
9898
494
9999
(1 row)
100100

101+
SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}');
102+
count
103+
-------
104+
158
105+
(1 row)
106+
107+
SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme';
108+
count
109+
-------
110+
0
111+
(1 row)
112+
113+
SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme';
114+
count
115+
-------
116+
508
117+
(1 row)
118+
101119
create index wowidx on test_tsvector using gist (a);
102120
SET enable_seqscan=OFF;
121+
SET enable_indexscan=ON;
122+
SET enable_bitmapscan=OFF;
123+
explain (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
124+
QUERY PLAN
125+
-------------------------------------------------------
126+
Aggregate
127+
-> Index Scan using wowidx on test_tsvector
128+
Index Cond: (a @@ '''wr'' | ''qh'''::tsquery)
129+
(3 rows)
130+
131+
SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
132+
count
133+
-------
134+
158
135+
(1 row)
136+
137+
SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh';
138+
count
139+
-------
140+
17
141+
(1 row)
142+
143+
SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt';
144+
count
145+
-------
146+
6
147+
(1 row)
148+
149+
SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt';
150+
count
151+
-------
152+
98
153+
(1 row)
154+
155+
SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)';
156+
count
157+
-------
158+
23
159+
(1 row)
160+
161+
SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)';
162+
count
163+
-------
164+
39
165+
(1 row)
166+
167+
SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*';
168+
count
169+
-------
170+
494
171+
(1 row)
172+
173+
SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}');
174+
count
175+
-------
176+
158
177+
(1 row)
178+
179+
SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme';
180+
count
181+
-------
182+
0
183+
(1 row)
184+
185+
SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme';
186+
count
187+
-------
188+
508
189+
(1 row)
190+
191+
SET enable_indexscan=OFF;
192+
SET enable_bitmapscan=ON;
193+
explain (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
194+
QUERY PLAN
195+
-------------------------------------------------------------
196+
Aggregate
197+
-> Bitmap Heap Scan on test_tsvector
198+
Recheck Cond: (a @@ '''wr'' | ''qh'''::tsquery)
199+
-> Bitmap Index Scan on wowidx
200+
Index Cond: (a @@ '''wr'' | ''qh'''::tsquery)
201+
(5 rows)
202+
103203
SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
104204
count
105205
-------
@@ -148,10 +248,35 @@ SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}');
148248
158
149249
(1 row)
150250

251+
SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme';
252+
count
253+
-------
254+
0
255+
(1 row)
256+
257+
SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme';
258+
count
259+
-------
260+
508
261+
(1 row)
262+
151263
RESET enable_seqscan;
264+
RESET enable_indexscan;
265+
RESET enable_bitmapscan;
152266
DROP INDEX wowidx;
153267
CREATE INDEX wowidx ON test_tsvector USING gin (a);
154268
SET enable_seqscan=OFF;
269+
-- GIN only supports bitmapscan, so no need to test plain indexscan
270+
explain (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
271+
QUERY PLAN
272+
-------------------------------------------------------------
273+
Aggregate
274+
-> Bitmap Heap Scan on test_tsvector
275+
Recheck Cond: (a @@ '''wr'' | ''qh'''::tsquery)
276+
-> Bitmap Index Scan on wowidx
277+
Index Cond: (a @@ '''wr'' | ''qh'''::tsquery)
278+
(5 rows)
279+
155280
SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh';
156281
count
157282
-------
@@ -200,6 +325,18 @@ SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}');
200325
158
201326
(1 row)
202327

328+
SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme';
329+
count
330+
-------
331+
0
332+
(1 row)
333+
334+
SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme';
335+
count
336+
-------
337+
508
338+
(1 row)
339+
203340
RESET enable_seqscan;
204341
INSERT INTO test_tsvector VALUES ('???', 'DFG:1A,2B,6C,10 FGH');
205342
SELECT * FROM ts_stat('SELECT a FROM test_tsvector') ORDER BY ndoc DESC, nentry DESC, word LIMIT 10;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy