Skip to content

Commit 6ff465a

Browse files
committed
Merge documentation fixes
2 parents 945629e + 46e006d commit 6ff465a

File tree

15 files changed

+472
-167
lines changed

15 files changed

+472
-167
lines changed

contrib/seg/seg.c

Lines changed: 195 additions & 105 deletions
Large diffs are not rendered by default.

doc/src/sgml/logicaldecoding.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</indexterm>
77
<para>
88
&productname; provides infrastructure to stream the modifications performed
9-
via SQL to external consumers. This functionality can be used to for a
9+
via SQL to external consumers. This functionality can be used for a
1010
variety of purposes, including replication solutions and auditing.
1111
</para>
1212

doc/src/sgml/ref/pgbench.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ END;
10181018
0 84 4142 0 1412881037 918023 2333
10191019
0 85 2465 0 1412881037 919759 740
10201020
</screen>
1021-
In this example, transaction 82 was late, because it's latency (6.173 ms) was
1021+
In this example, transaction 82 was late, because its latency (6.173 ms) was
10221022
over the 5 ms limit. The next two transactions were skipped, because they
10231023
were already late before they were even started.
10241024
</para>
@@ -1059,7 +1059,7 @@ END;
10591059
</para>
10601060

10611061
<para>
1062-
Here is example outputs:
1062+
Here is example output:
10631063
<screen>
10641064
1345828501 5601 1542744 483552416 61 2573
10651065
1345828503 7884 1979812 565806736 60 1479
@@ -1069,8 +1069,8 @@ END;
10691069
</screen></para>
10701070

10711071
<para>
1072-
Notice that while the plain (unaggregated) log file contains index
1073-
of the custom script files, the aggregated log does not. Therefore if
1072+
Notice that while the plain (unaggregated) log file contains a reference
1073+
to the custom script files, the aggregated log does not. Therefore if
10741074
you need per script data, you need to aggregate the data on your own.
10751075
</para>
10761076

src/backend/optimizer/plan/initsplan.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,9 +1156,32 @@ make_outerjoininfo(PlannerInfo *root,
11561156
{
11571157
SpecialJoinInfo *otherinfo = (SpecialJoinInfo *) lfirst(l);
11581158

1159-
/* ignore full joins --- other mechanisms preserve their ordering */
1159+
/*
1160+
* A full join is an optimization barrier: we can't associate into or
1161+
* out of it. Hence, if it overlaps either LHS or RHS of the current
1162+
* rel, expand that side's min relset to cover the whole full join.
1163+
*/
11601164
if (otherinfo->jointype == JOIN_FULL)
1165+
{
1166+
if (bms_overlap(left_rels, otherinfo->syn_lefthand) ||
1167+
bms_overlap(left_rels, otherinfo->syn_righthand))
1168+
{
1169+
min_lefthand = bms_add_members(min_lefthand,
1170+
otherinfo->syn_lefthand);
1171+
min_lefthand = bms_add_members(min_lefthand,
1172+
otherinfo->syn_righthand);
1173+
}
1174+
if (bms_overlap(right_rels, otherinfo->syn_lefthand) ||
1175+
bms_overlap(right_rels, otherinfo->syn_righthand))
1176+
{
1177+
min_righthand = bms_add_members(min_righthand,
1178+
otherinfo->syn_lefthand);
1179+
min_righthand = bms_add_members(min_righthand,
1180+
otherinfo->syn_righthand);
1181+
}
1182+
/* Needn't do anything else with the full join */
11611183
continue;
1184+
}
11621185

11631186
/*
11641187
* For a lower OJ in our LHS, if our join condition uses the lower

src/backend/parser/parse_expr.c

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,14 @@ transformAExprOp(ParseState *pstate, A_Expr *a)
857857
emit_precedence_warnings(pstate, opgroup, opname,
858858
lexpr, rexpr,
859859
a->location);
860+
861+
/* Look through AEXPR_PAREN nodes so they don't affect tests below */
862+
while (lexpr && IsA(lexpr, A_Expr) &&
863+
((A_Expr *) lexpr)->kind == AEXPR_PAREN)
864+
lexpr = ((A_Expr *) lexpr)->lexpr;
865+
while (rexpr && IsA(rexpr, A_Expr) &&
866+
((A_Expr *) rexpr)->kind == AEXPR_PAREN)
867+
rexpr = ((A_Expr *) rexpr)->lexpr;
860868
}
861869

862870
/*
@@ -1903,6 +1911,11 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
19031911
Node *e = (Node *) lfirst(element);
19041912
Node *newe;
19051913

1914+
/* Look through AEXPR_PAREN nodes so they don't affect test below */
1915+
while (e && IsA(e, A_Expr) &&
1916+
((A_Expr *) e)->kind == AEXPR_PAREN)
1917+
e = ((A_Expr *) e)->lexpr;
1918+
19061919
/*
19071920
* If an element is itself an A_ArrayExpr, recurse directly so that we
19081921
* can pass down any target type we were given.
@@ -2453,29 +2466,40 @@ transformWholeRowRef(ParseState *pstate, RangeTblEntry *rte, int location)
24532466
/*
24542467
* Handle an explicit CAST construct.
24552468
*
2456-
* Transform the argument, then look up the type name and apply any necessary
2469+
* Transform the argument, look up the type name, and apply any necessary
24572470
* coercion function(s).
24582471
*/
24592472
static Node *
24602473
transformTypeCast(ParseState *pstate, TypeCast *tc)
24612474
{
24622475
Node *result;
2476+
Node *arg = tc->arg;
24632477
Node *expr;
24642478
Oid inputType;
24652479
Oid targetType;
24662480
int32 targetTypmod;
24672481
int location;
24682482

2483+
/* Look up the type name first */
24692484
typenameTypeIdAndMod(pstate, tc->typeName, &targetType, &targetTypmod);
24702485

2486+
/*
2487+
* Look through any AEXPR_PAREN nodes that may have been inserted thanks
2488+
* to operator_precedence_warning. Otherwise, ARRAY[]::foo[] behaves
2489+
* differently from (ARRAY[])::foo[].
2490+
*/
2491+
while (arg && IsA(arg, A_Expr) &&
2492+
((A_Expr *) arg)->kind == AEXPR_PAREN)
2493+
arg = ((A_Expr *) arg)->lexpr;
2494+
24712495
/*
24722496
* If the subject of the typecast is an ARRAY[] construct and the target
24732497
* type is an array type, we invoke transformArrayExpr() directly so that
24742498
* we can pass down the type information. This avoids some cases where
24752499
* transformArrayExpr() might not infer the correct type. Otherwise, just
24762500
* transform the argument normally.
24772501
*/
2478-
if (IsA(tc->arg, A_ArrayExpr))
2502+
if (IsA(arg, A_ArrayExpr))
24792503
{
24802504
Oid targetBaseType;
24812505
int32 targetBaseTypmod;
@@ -2493,16 +2517,16 @@ transformTypeCast(ParseState *pstate, TypeCast *tc)
24932517
if (OidIsValid(elementType))
24942518
{
24952519
expr = transformArrayExpr(pstate,
2496-
(A_ArrayExpr *) tc->arg,
2520+
(A_ArrayExpr *) arg,
24972521
targetBaseType,
24982522
elementType,
24992523
targetBaseTypmod);
25002524
}
25012525
else
2502-
expr = transformExprRecurse(pstate, tc->arg);
2526+
expr = transformExprRecurse(pstate, arg);
25032527
}
25042528
else
2505-
expr = transformExprRecurse(pstate, tc->arg);
2529+
expr = transformExprRecurse(pstate, arg);
25062530

25072531
inputType = exprType(expr);
25082532
if (inputType == InvalidOid)

src/backend/port/win32/socket.c

Lines changed: 68 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
*/
2828
int pgwin32_noblock = 0;
2929

30+
/* Undef the macros defined in win32.h, so we can access system functions */
3031
#undef socket
32+
#undef bind
33+
#undef listen
3134
#undef accept
3235
#undef connect
3336
#undef select
@@ -41,23 +44,38 @@ int pgwin32_noblock = 0;
4144

4245
/*
4346
* Convert the last socket error code into errno
47+
*
48+
* Note: where there is a direct correspondence between a WSAxxx error code
49+
* and a Berkeley error symbol, this mapping is actually a no-op, because
50+
* in win32.h we redefine the network-related Berkeley error symbols to have
51+
* the values of their WSAxxx counterparts. The point of the switch is
52+
* mostly to translate near-miss error codes into something that's sensible
53+
* in the Berkeley universe.
4454
*/
4555
static void
4656
TranslateSocketError(void)
4757
{
4858
switch (WSAGetLastError())
4959
{
50-
case WSANOTINITIALISED:
51-
case WSAENETDOWN:
52-
case WSAEINPROGRESS:
5360
case WSAEINVAL:
54-
case WSAESOCKTNOSUPPORT:
55-
case WSAEFAULT:
61+
case WSANOTINITIALISED:
5662
case WSAEINVALIDPROVIDER:
5763
case WSAEINVALIDPROCTABLE:
58-
case WSAEMSGSIZE:
64+
case WSAEDESTADDRREQ:
5965
errno = EINVAL;
6066
break;
67+
case WSAEINPROGRESS:
68+
errno = EINPROGRESS;
69+
break;
70+
case WSAEFAULT:
71+
errno = EFAULT;
72+
break;
73+
case WSAEISCONN:
74+
errno = EISCONN;
75+
break;
76+
case WSAEMSGSIZE:
77+
errno = EMSGSIZE;
78+
break;
6179
case WSAEAFNOSUPPORT:
6280
errno = EAFNOSUPPORT;
6381
break;
@@ -69,16 +87,23 @@ TranslateSocketError(void)
6987
break;
7088
case WSAEPROTONOSUPPORT:
7189
case WSAEPROTOTYPE:
90+
case WSAESOCKTNOSUPPORT:
7291
errno = EPROTONOSUPPORT;
7392
break;
93+
case WSAECONNABORTED:
94+
errno = ECONNABORTED;
95+
break;
7496
case WSAECONNREFUSED:
7597
errno = ECONNREFUSED;
7698
break;
99+
case WSAECONNRESET:
100+
errno = ECONNRESET;
101+
break;
77102
case WSAEINTR:
78103
errno = EINTR;
79104
break;
80105
case WSAENOTSOCK:
81-
errno = EBADFD;
106+
errno = ENOTSOCK;
82107
break;
83108
case WSAEOPNOTSUPP:
84109
errno = EOPNOTSUPP;
@@ -89,13 +114,24 @@ TranslateSocketError(void)
89114
case WSAEACCES:
90115
errno = EACCES;
91116
break;
92-
case WSAENOTCONN:
117+
case WSAEADDRINUSE:
118+
errno = EADDRINUSE;
119+
break;
120+
case WSAEADDRNOTAVAIL:
121+
errno = EADDRNOTAVAIL;
122+
break;
123+
case WSAEHOSTUNREACH:
124+
case WSAEHOSTDOWN:
125+
case WSAHOST_NOT_FOUND:
126+
case WSAENETDOWN:
127+
case WSAENETUNREACH:
93128
case WSAENETRESET:
94-
case WSAECONNRESET:
129+
errno = EHOSTUNREACH;
130+
break;
131+
case WSAENOTCONN:
95132
case WSAESHUTDOWN:
96-
case WSAECONNABORTED:
97133
case WSAEDISCON:
98-
errno = ECONNREFUSED; /* ENOTCONN? */
134+
errno = ENOTCONN;
99135
break;
100136
default:
101137
ereport(NOTICE,
@@ -261,6 +297,27 @@ pgwin32_socket(int af, int type, int protocol)
261297
return s;
262298
}
263299

300+
int
301+
pgwin32_bind(SOCKET s, struct sockaddr * addr, int addrlen)
302+
{
303+
int res;
304+
305+
res = bind(s, addr, addrlen);
306+
if (res < 0)
307+
TranslateSocketError();
308+
return res;
309+
}
310+
311+
int
312+
pgwin32_listen(SOCKET s, int backlog)
313+
{
314+
int res;
315+
316+
res = listen(s, backlog);
317+
if (res < 0)
318+
TranslateSocketError();
319+
return res;
320+
}
264321

265322
SOCKET
266323
pgwin32_accept(SOCKET s, struct sockaddr * addr, int *addrlen)

0 commit comments

Comments
 (0)