Skip to content

Commit 6df5af5

Browse files
authored
Merge branch 'main' into fix_GetDatabasePath_leak
2 parents 24c4f39 + f8210ef commit 6df5af5

File tree

7 files changed

+43
-21
lines changed

7 files changed

+43
-21
lines changed

gpMgmt/bin/gpstart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,7 @@ class GpStart:
902902

903903
if is_external_fts:
904904
if options.fts_hosts is None:
905-
coordinator_data_directory = os.getenv('COORDINATOR_DATA_DIRECTORY')
906-
if coordinator_data_directory is None:
907-
coordinator_data_directory = options.coordinatorDataDirectory
905+
coordinator_data_directory = gp.get_coordinatordatadir()
908906
options.fts_hosts = coordinator_data_directory + '/config' + '/fts_host'
909907

910908
return GpStart(options.specialMode, options.restricted,

gpMgmt/bin/gpstop

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -959,9 +959,7 @@ class GpStop:
959959

960960
if is_external_fts:
961961
if options.fts_hosts is None:
962-
coordinator_data_directory = os.getenv('COORDINATOR_DATA_DIRECTORY')
963-
if coordinator_data_directory is None:
964-
coordinator_data_directory = options.coordinatorDataDirectory
962+
coordinator_data_directory = gp.get_coordinatordatadir()
965963

966964
options.fts_hosts = coordinator_data_directory + '/config' + '/fts_host'
967965

src/backend/parser/parse_agg.c

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,6 @@ transformAggregateCall(ParseState *pstate, Aggref *agg,
115115
int save_next_resno;
116116
ListCell *lc;
117117

118-
/*
119-
* Before separating the args into direct and aggregated args, make a list
120-
* of their data type OIDs for use later.
121-
*/
122-
foreach(lc, args)
123-
{
124-
Expr *arg = (Expr *) lfirst(lc);
125-
126-
argtypes = lappend_oid(argtypes, exprType((Node *) arg));
127-
}
128-
agg->aggargtypes = argtypes;
129-
130118
if (AGGKIND_IS_ORDERED_SET(agg->aggkind))
131119
{
132120
/*
@@ -238,6 +226,29 @@ transformAggregateCall(ParseState *pstate, Aggref *agg,
238226
agg->aggorder = torder;
239227
agg->aggdistinct = tdistinct;
240228

229+
/*
230+
* Now build the aggargtypes list with the type OIDs of the direct and
231+
* aggregated args, ignoring any resjunk entries that might have been
232+
* added by ORDER BY/DISTINCT processing. We can't do this earlier
233+
* because said processing can modify some args' data types, in particular
234+
* by resolving previously-unresolved "unknown" literals.
235+
*/
236+
foreach(lc, agg->aggdirectargs)
237+
{
238+
Expr *arg = (Expr *) lfirst(lc);
239+
240+
argtypes = lappend_oid(argtypes, exprType((Node *) arg));
241+
}
242+
foreach(lc, tlist)
243+
{
244+
TargetEntry *tle = (TargetEntry *) lfirst(lc);
245+
246+
if (tle->resjunk)
247+
continue; /* ignore junk */
248+
argtypes = lappend_oid(argtypes, exprType((Node *) tle->expr));
249+
}
250+
agg->aggargtypes = argtypes;
251+
241252
check_agglevels_and_constraints(pstate, (Node *) agg);
242253
}
243254

src/bin/pg_upgrade/pg_upgrade.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,7 @@ get_cluster_version(ClusterInfo *cluster)
371371

372372
PQfinish(conn);
373373

374-
stop_postmaster(cluster);
375-
376-
return;
374+
stop_postmaster(false);
377375
}
378376

379377
#ifdef WIN32

src/test/regress/expected/jsonb.out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,13 @@ SELECT jsonb_object_agg(name, type) FROM foo;
15581558
INSERT INTO foo VALUES (999999, NULL, 'bar');
15591559
SELECT jsonb_object_agg(name, type) FROM foo;
15601560
ERROR: field name must not be null
1561+
-- edge case for parser
1562+
SELECT jsonb_object_agg(DISTINCT 'a', 'abc');
1563+
jsonb_object_agg
1564+
------------------
1565+
{"a": "abc"}
1566+
(1 row)
1567+
15611568
-- jsonb_object
15621569
-- empty object, one dimension
15631570
SELECT jsonb_object('{}');

src/test/regress/expected/jsonb_optimizer.out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,6 +1560,13 @@ SELECT jsonb_object_agg(name, type) FROM foo;
15601560
INSERT INTO foo VALUES (999999, NULL, 'bar');
15611561
SELECT jsonb_object_agg(name, type) FROM foo;
15621562
ERROR: field name must not be null
1563+
-- edge case for parser
1564+
SELECT jsonb_object_agg(DISTINCT 'a', 'abc');
1565+
jsonb_object_agg
1566+
------------------
1567+
{"a": "abc"}
1568+
(1 row)
1569+
15631570
-- jsonb_object
15641571
-- empty object, one dimension
15651572
SELECT jsonb_object('{}');

src/test/regress/sql/jsonb.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ SELECT jsonb_object_agg(name, type) FROM foo;
397397
INSERT INTO foo VALUES (999999, NULL, 'bar');
398398
SELECT jsonb_object_agg(name, type) FROM foo;
399399

400+
-- edge case for parser
401+
SELECT jsonb_object_agg(DISTINCT 'a', 'abc');
402+
400403
-- jsonb_object
401404

402405
-- empty object, one dimension

0 commit comments

Comments
 (0)