Skip to content

Commit cf63c64

Browse files
committed
Fix portability issue in ordered-set patch.
Overly compact coding in makeOrderedSetArgs() led to a platform dependency: if the compiler chose to execute the subexpressions in the wrong order, list_length() might get applied to an already-modified List, giving a value we didn't want. Per buildfarm.
1 parent 8d65da1 commit cf63c64

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/backend/parser/gram.y

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13385,6 +13385,7 @@ makeOrderedSetArgs(List *directargs, List *orderedargs,
1338513385
core_yyscan_t yyscanner)
1338613386
{
1338713387
FunctionParameter *lastd = (FunctionParameter *) llast(directargs);
13388+
int ndirectargs;
1338813389

1338913390
/* No restriction unless last direct arg is VARIADIC */
1339013391
if (lastd->mode == FUNC_PARAM_VARIADIC)
@@ -13407,8 +13408,11 @@ makeOrderedSetArgs(List *directargs, List *orderedargs,
1340713408
orderedargs = NIL;
1340813409
}
1340913410

13411+
/* don't merge into the next line, as list_concat changes directargs */
13412+
ndirectargs = list_length(directargs);
13413+
1341013414
return list_make2(list_concat(directargs, orderedargs),
13411-
makeInteger(list_length(directargs)));
13415+
makeInteger(ndirectargs));
1341213416
}
1341313417

1341413418
/* insertSelectOptions()

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