This is an automated email from the ASF dual-hosted git repository. my-ship-it pushed a commit to branch REL_2_STABLE in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit a27ca0ca9aae3c555e36b4ee5a2a4296567d066c Author: Jinbao Chen <[email protected]> AuthorDate: Mon Aug 17 13:58:55 2026 -0400 Cherry-pick some commits from the main branch from "Add AI_GUIDLINE for clarification how to use AI agents" to "PAX regress: refresh expected outputs for AO-like index routing" --- contrib/extprotocol/gpextprotocol.c | 2 +- contrib/ltree/ltree_io.c | 18 +-- contrib/pgcrypto/Makefile | 4 +- gpMgmt/bin/analyzedb | 4 +- gpMgmt/bin/gpconfig | 3 +- gpMgmt/bin/gppylib/commands/gp.py | 5 +- gpMgmt/bin/gppylib/commands/pg.py | 6 +- .../bin/gppylib/operations/buildMirrorSegments.py | 6 +- .../mgmt_utils/steps/gpssh_exkeys_mgmt_utils.py | 32 +++--- gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py | 6 +- .../mgmt_utils/steps/tablespace_mgmt_utils.py | 6 +- gpMgmt/test/behave_utils/utils.py | 4 +- gpcontrib/gp_replica_check/gp_replica_check.py | 4 +- gpcontrib/pg_hint_plan/pg_hint_plan.c | 4 +- .../reject_partition_fullscan.c | 2 +- src/backend/catalog/pg_type.c | 2 +- src/backend/cdb/dispatcher/cdbgang.c | 6 +- src/backend/commands/resgroupcmds.c | 8 +- src/backend/commands/statscmds.c | 3 +- src/backend/executor/nodeHashjoin.c | 15 +++ src/backend/optimizer/path/indxpath.c | 9 +- src/backend/utils/adt/xid8funcs.c | 4 +- src/backend/utils/cache/syscache.c | 8 +- src/backend/utils/misc/fstream/fstream.c | 2 +- src/backend/utils/misc/uriparser.c | 2 +- src/backend/utils/mmgr/mcxt.c | 126 --------------------- src/bin/gpfdist/gpfdist.c | 2 +- src/bin/pg_waldump/pg_waldump.c | 2 +- src/bin/pgbench/pgbench.c | 2 +- src/include/common/fe_memutils.h | 10 -- src/include/utils/elog.h | 59 ++++++++++ src/include/utils/tarrable.h | 2 +- src/interfaces/ecpg/pgtypeslib/datetime.c | 2 +- src/interfaces/libpq/fe-connect.c | 6 +- src/interfaces/libpq/fe-exec.c | 12 +- src/test/regress/GNUmakefile | 2 + src/test/regress/expected/dboptions.out | 2 +- src/test/regress/expected/stats_ext.out | 14 ++- src/test/regress/expected/stats_ext_optimizer.out | 14 ++- src/test/regress/gpdiff.pl | 2 +- src/test/regress/pg_regress.c | 6 +- src/test/regress/scan_flaky_fault_injectors.sh | 6 + src/timezone/zic.c | 2 +- 43 files changed, 191 insertions(+), 245 deletions(-) diff --git a/contrib/extprotocol/gpextprotocol.c b/contrib/extprotocol/gpextprotocol.c index 26d75bcda39..69aed97f48d 100644 --- a/contrib/extprotocol/gpextprotocol.c +++ b/contrib/extprotocol/gpextprotocol.c @@ -299,7 +299,7 @@ DemoUri *ParseDemoUri(const char *uri_str) /* * parse protocol */ - char *post_protocol = strstr(uri_str, "://"); + const char *post_protocol = strstr(uri_str, "://"); if(!post_protocol) { diff --git a/contrib/ltree/ltree_io.c b/contrib/ltree/ltree_io.c index 1e24f54ec62..8e054b55b95 100644 --- a/contrib/ltree/ltree_io.c +++ b/contrib/ltree/ltree_io.c @@ -339,12 +339,7 @@ parse_lquery(const char *buf) lptr++; lptr->start = ptr; state = LQPRS_WAITDELIM; - if (pg_add_u16_overflow(curqlevel->numvar, 1, &curqlevel->numvar)) - ereturn(escontext, NULL, - (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("lquery level has too many variants"), - errdetail("Number of variants exceeds the maximum allowed (%d).", - PG_UINT16_MAX))); + curqlevel->numvar++; } else UNCHAR; @@ -536,16 +531,7 @@ parse_lquery(const char *buf) lptr = GETVAR(curqlevel); while (lptr - GETVAR(curqlevel) < curqlevel->numvar) { - int newlen = cur->totallen + MAXALIGN(LVAR_HDRSIZE + lptr->len); - - if (newlen > PG_UINT16_MAX) - ereturn(escontext, NULL, - (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("lquery level is too large"), - errdetail("Total size of level exceeds the maximum allowed (%d bytes).", - PG_UINT16_MAX))); - cur->totallen = (uint16) newlen; - + cur->totallen += MAXALIGN(LVAR_HDRSIZE + lptr->len); lrptr->len = lptr->len; lrptr->flag = lptr->flag; lrptr->val = ltree_crc32_sz(lptr->start, lptr->len); diff --git a/contrib/pgcrypto/Makefile b/contrib/pgcrypto/Makefile index 86760850d5b..104451d75b0 100644 --- a/contrib/pgcrypto/Makefile +++ b/contrib/pgcrypto/Makefile @@ -55,8 +55,8 @@ REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael sm4 \ $(CF_TESTS) \ crypt-des crypt-md5 crypt-blowfish crypt-xdes \ pgp-armor pgp-decrypt pgp-encrypt $(CF_PGP_TESTS) \ - pgp-pubkey-decrypt pgp-pubkey-encrypt pgp-pubkey-session - pgp-info setup_fips fips \ + pgp-pubkey-decrypt pgp-pubkey-encrypt pgp-pubkey-session \ + pgp-info setup_fips fips EXTRA_CLEAN = gen-rtab diff --git a/gpMgmt/bin/analyzedb b/gpMgmt/bin/analyzedb index 48d8e16872c..ff7ced099f1 100755 --- a/gpMgmt/bin/analyzedb +++ b/gpMgmt/bin/analyzedb @@ -22,7 +22,7 @@ import tempfile import time from datetime import datetime, timedelta from contextlib import closing -import pipes # for shell-quoting, pipes.quote() +import shlex # for shell-quoting, shlex.quote() import fcntl import itertools @@ -950,7 +950,7 @@ class AnalyzeDb(Operation): # Create a Command object that executes a query using psql. def create_psql_command(dbname, query): - psql_cmd = """psql %s -c %s""" % (pipes.quote(dbname), pipes.quote(query)) + psql_cmd = """psql %s -c %s""" % (shlex.quote(dbname), shlex.quote(query)) return Command(query, psql_cmd) diff --git a/gpMgmt/bin/gpconfig b/gpMgmt/bin/gpconfig index f4e3ce7c62d..ce410ca50c1 100755 --- a/gpMgmt/bin/gpconfig +++ b/gpMgmt/bin/gpconfig @@ -15,6 +15,7 @@ import os import sys import re +import shlex import psutil try: @@ -382,7 +383,7 @@ def do_change(options): # Replace literal empty strings with empty quotes, or it will look like the # user passed in an incorrect argument, which would be misleading - params = [pipes.quote(arg) for arg in sys.argv[1:]] + params = [shlex.quote(arg) for arg in sys.argv[1:]] params = " ".join(params) if failure: LOGGER.error("finished with errors, parameter string '%s'" % params) diff --git a/gpMgmt/bin/gppylib/commands/gp.py b/gpMgmt/bin/gppylib/commands/gp.py index 49b305f7cd0..b980bc629c4 100644 --- a/gpMgmt/bin/gppylib/commands/gp.py +++ b/gpMgmt/bin/gppylib/commands/gp.py @@ -12,7 +12,6 @@ import base64 import pickle import shlex import os.path -import pipes import subprocess import re, socket @@ -939,7 +938,7 @@ class ConfigureNewSegment(Command): batchSize=None, verbose=False,ctxt=LOCAL, remoteHost=None, validationOnly=False, writeGpIdFileOnly=False, forceoverwrite=False): - cmdStr = '$GPHOME/bin/lib/gpconfigurenewsegment -c \"%s\" -l %s' % (confinfo, pipes.quote(logdir)) + cmdStr = '$GPHOME/bin/lib/gpconfigurenewsegment -c \"%s\" -l %s' % (confinfo, shlex.quote(logdir)) if newSegments: cmdStr += ' -n' @@ -1041,7 +1040,7 @@ class GpSegRecovery(Command): def _get_cmd_for_recovery_wrapper(wrapper_filename, confinfo, logdir, batchSize, verbose, forceoverwrite, era=None): - cmdStr = '$GPHOME/sbin/{}.py -c {} -l {}'.format(wrapper_filename, pipes.quote(confinfo), pipes.quote(logdir)) + cmdStr = '$GPHOME/sbin/{}.py -c {} -l {}'.format(wrapper_filename, shlex.quote(confinfo), shlex.quote(logdir)) if verbose: cmdStr += ' -v' diff --git a/gpMgmt/bin/gppylib/commands/pg.py b/gpMgmt/bin/gppylib/commands/pg.py index f430b294500..428a0e3ee16 100644 --- a/gpMgmt/bin/gppylib/commands/pg.py +++ b/gpMgmt/bin/gppylib/commands/pg.py @@ -5,7 +5,7 @@ from contextlib import closing import os -import pipes +import shlex from gppylib.gplog import * from gppylib.gparray import * @@ -226,7 +226,7 @@ class PgRewind(Command): # pg_rewind prints progress updates to stdout, but it also prints # errors relating to relevant failures(like it will not rewind due to # a corrupted pg_control file) to stderr. - rewind_cmd = rewind_cmd + " > {} 2>&1".format(pipes.quote(progress_file)) + rewind_cmd = rewind_cmd + " > {} 2>&1".format(shlex.quote(progress_file)) self.cmdStr = rewind_cmd Command.__init__(self, name, self.cmdStr, LOCAL) @@ -283,7 +283,7 @@ class PgBaseBackup(Command): cmd_tokens.append('--verbose') if progress_file: - cmd_tokens.append('> %s 2>&1' % pipes.quote(progress_file)) + cmd_tokens.append('> %s 2>&1' % shlex.quote(progress_file)) cmd_str = ' '.join(cmd_tokens) diff --git a/gpMgmt/bin/gppylib/operations/buildMirrorSegments.py b/gpMgmt/bin/gppylib/operations/buildMirrorSegments.py index a071aa89e83..2e5212357d0 100644 --- a/gpMgmt/bin/gppylib/operations/buildMirrorSegments.py +++ b/gpMgmt/bin/gppylib/operations/buildMirrorSegments.py @@ -1,6 +1,6 @@ from contextlib import closing import os -import pipes +import shlex import signal import time import re @@ -441,13 +441,13 @@ class GpMirrorListToBuild: if self.__progressMode != GpMirrorListToBuild.Progress.NONE: return GpMirrorListToBuild.ProgressCommand("tail the last line of the file", "set -o pipefail; touch -a {0}; tail -1 {0} | tr '\\r' '\\n' |" - " tail -1".format(pipes.quote(progressFile)), + " tail -1".format(shlex.quote(progressFile)), targetSegmentDbId, progressFile, ctxt=base.REMOTE, remoteHost=targetHostname) return None def _get_remove_cmd(self, remove_file, target_host): - return base.Command("remove file", "rm -f {}".format(pipes.quote(remove_file)), ctxt=base.REMOTE, remoteHost=target_host) + return base.Command("remove file", "rm -f {}".format(shlex.quote(remove_file)), ctxt=base.REMOTE, remoteHost=target_host) def __runWaitAndCheckWorkerPoolForErrorsAndClear(self, cmds, suppressErrorCheck=False, progressCmds=[]): for cmd in cmds: diff --git a/gpMgmt/test/behave/mgmt_utils/steps/gpssh_exkeys_mgmt_utils.py b/gpMgmt/test/behave/mgmt_utils/steps/gpssh_exkeys_mgmt_utils.py index 9e8d57d8a65..52b731aa149 100644 --- a/gpMgmt/test/behave/mgmt_utils/steps/gpssh_exkeys_mgmt_utils.py +++ b/gpMgmt/test/behave/mgmt_utils/steps/gpssh_exkeys_mgmt_utils.py @@ -6,7 +6,7 @@ import subprocess import sys import tempfile -import pipes +import shlex from behave import given, when, then from test.behave_utils.utils import * @@ -57,26 +57,22 @@ def run_exkeys(hosts, capture=False): # Capture stdout/err for later use, while routing it through tee(1) so that # developers can still see the live stream output. # - # XXX This is a very heavy-weight solution, using pipes.Template() for the - # creation of shell pipeline processes. It's also platform-specific as it - # relies on the functionality of /dev/stdout and /dev/stderr. - # - # The overview: we open up two shell processes running tee(1), using - # pipes.Template(), and connect their standard output to the stdout/err of - # the current Python process using Template.open(). We then connect the - # stdout/stderr streams of subprocess.call() to the stdin of those tee - # pipelines. tee(1) will duplicate all output to temporary files, which we + # The overview: we spawn two tee(1) processes and connect their standard + # output to the stdout/err of the current Python process. We then connect + # the stdout/stderr streams of subprocess.call() to the stdin of those tee + # processes. tee(1) will duplicate all output to temporary files, which we # read after the subprocess call completes. NamedTemporaryFile() then cleans # up those files when we return. with tempfile.NamedTemporaryFile() as temp_out, tempfile.NamedTemporaryFile() as temp_err: - pipe_out = pipes.Template() - pipe_out.append('tee %s' % pipes.quote(temp_out.name), '--') + tee_out = subprocess.Popen(['tee', temp_out.name], stdin=subprocess.PIPE, stdout=sys.stdout) + tee_err = subprocess.Popen(['tee', temp_err.name], stdin=subprocess.PIPE, stdout=sys.stderr) - pipe_err = pipes.Template() - pipe_err.append('tee %s' % pipes.quote(temp_err.name), '--') + ret = subprocess.call(args, stdout=tee_out.stdin, stderr=tee_err.stdin) - with pipe_out.open('/dev/stdout', 'w') as out, pipe_err.open('/dev/stderr', 'w') as err: - ret = subprocess.call(args, stdout=out, stderr=err) + tee_out.stdin.close() + tee_err.stdin.close() + tee_out.wait() + tee_err.wait() stored_out = temp_out.read().decode() stored_err = temp_err.read().decode() @@ -310,11 +306,11 @@ def impl(context, ssh_type): host_opts.extend(['-h', host]) # ssh'ing to localhost need not be set up yet - subprocess.check_call([ 'bash', '-c', '! sort %s | uniq -d | grep .' % path.join('~/.ssh',pipes.quote(ssh_type))]) + subprocess.check_call([ 'bash', '-c', '! sort %s | uniq -d | grep .' % path.join('~/.ssh',shlex.quote(ssh_type))]) subprocess.check_call([ 'gpssh', '-e', ] + host_opts + [ - '! sort %s | uniq -d | grep .' % path.join('~/.ssh',pipes.quote(ssh_type)) + '! sort %s | uniq -d | grep .' % path.join('~/.ssh',shlex.quote(ssh_type)) ]) diff --git a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py index 5af0e37762e..7af8835564b 100644 --- a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py +++ b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py @@ -4,7 +4,7 @@ import glob import json import os import re -import pipes +import shlex import shutil import socket import tempfile @@ -1445,7 +1445,7 @@ def stop_segments(context, where_clause): # Thus, need to add pg_ctl to the path when ssh'ing to a demo cluster. subprocess.check_call(['ssh', seg.getSegmentHostName(), 'source %s/cloudberry-env.sh && pg_ctl stop -m fast -D %s -w -t 120' % ( - pipes.quote(os.environ.get("GPHOME")), pipes.quote(seg.getSegmentDataDirectory())) + shlex.quote(os.environ.get("GPHOME")), shlex.quote(seg.getSegmentDataDirectory())) ]) @@ -1479,7 +1479,7 @@ def stop_segments_immediate(context, where_clause): # Thus, need to add pg_ctl to the path when ssh'ing to a demo cluster. subprocess.check_call(['ssh', seg.getSegmentHostName(), 'source %s/cloudberry-env.sh && pg_ctl stop -m immediate -D %s -w' % ( - pipes.quote(os.environ.get("GPHOME")), pipes.quote(seg.getSegmentDataDirectory())) + shlex.quote(os.environ.get("GPHOME")), shlex.quote(seg.getSegmentDataDirectory())) ]) @given('user can start transactions') diff --git a/gpMgmt/test/behave/mgmt_utils/steps/tablespace_mgmt_utils.py b/gpMgmt/test/behave/mgmt_utils/steps/tablespace_mgmt_utils.py index 9829ba4a126..4550ccafa64 100644 --- a/gpMgmt/test/behave/mgmt_utils/steps/tablespace_mgmt_utils.py +++ b/gpMgmt/test/behave/mgmt_utils/steps/tablespace_mgmt_utils.py @@ -1,4 +1,4 @@ -import pipes +import shlex import tempfile from behave import given, then @@ -19,7 +19,7 @@ class Tablespace: gparray = GpArray.initFromCatalog(dbconn.DbURL()) for host in gparray.getHostList(): - run_cmd('ssh %s mkdir -p %s' % (pipes.quote(host), pipes.quote(self.path))) + run_cmd('ssh %s mkdir -p %s' % (shlex.quote(host), shlex.quote(self.path))) conn = dbconn.connect(dbconn.DbURL(), unsetSearchPath=False) dbconn.execSQL(conn, "CREATE TABLESPACE %s LOCATION '%s'" % (self.name, self.path)) @@ -49,7 +49,7 @@ class Tablespace: gparray = GpArray.initFromCatalog(dbconn.DbURL()) for host in gparray.getHostList(): - run_cmd('ssh %s rm -rf %s' % (pipes.quote(host), pipes.quote(self.path))) + run_cmd('ssh %s rm -rf %s' % (shlex.quote(host), shlex.quote(self.path))) def verify(self, hostname=None, port=0): """ diff --git a/gpMgmt/test/behave_utils/utils.py b/gpMgmt/test/behave_utils/utils.py index bc62c15badf..17494440e5c 100644 --- a/gpMgmt/test/behave_utils/utils.py +++ b/gpMgmt/test/behave_utils/utils.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import fileinput import os -import pipes +import shlex import re import signal import stat @@ -232,7 +232,7 @@ def stop_primary(context, content_id): # Thus, need to add pg_ctl to the path when ssh'ing to a demo cluster. subprocess.check_call(['ssh', seg_host, 'source %s/cloudberry-env.sh && pg_ctl stop -m fast -D %s' % ( - pipes.quote(os.environ.get("GPHOME")), pipes.quote(seg_data_dir)) + shlex.quote(os.environ.get("GPHOME")), shlex.quote(seg_data_dir)) ]) diff --git a/gpcontrib/gp_replica_check/gp_replica_check.py b/gpcontrib/gp_replica_check/gp_replica_check.py index 1627b859c1e..dcb2d354e06 100755 --- a/gpcontrib/gp_replica_check/gp_replica_check.py +++ b/gpcontrib/gp_replica_check/gp_replica_check.py @@ -36,7 +36,7 @@ try: except: import subprocess import threading -import pipes # for shell-quoting, pipes.quote() +import shlex # for shell-quoting, shlex.quote() import time import os from collections import defaultdict @@ -78,7 +78,7 @@ Mirror Location: %s' % (self.getName(), self.host, self.port, self.datname, self.ploc, self.mloc) def wait_for_wal_sync(self): - cmd = "PGOPTIONS='-c gp_role=utility' psql -h %s -p %s -d %s -t -A -c \"SELECT pg_current_wal_lsn() AS master_wal, replay_lsn AS standby_wal, pg_current_wal_lsn() = replay_lsn AS are_equal FROM pg_stat_replication;\"" % (self.host, self.port, pipes.quote(self.datname)) + cmd = "PGOPTIONS='-c gp_role=utility' psql -h %s -p %s -d %s -t -A -c \"SELECT pg_current_wal_lsn() AS master_wal, replay_lsn AS standby_wal, pg_current_wal_lsn() = replay_lsn AS are_equal FROM pg_stat_replication;\"" % (self.host, self.port, shlex.quote(self.datname)) while True: try: output = subprocess.check_output(cmd, shell=True).decode().strip().split("\n") diff --git a/gpcontrib/pg_hint_plan/pg_hint_plan.c b/gpcontrib/pg_hint_plan/pg_hint_plan.c index 1d37677019c..a84bc524134 100644 --- a/gpcontrib/pg_hint_plan/pg_hint_plan.c +++ b/gpcontrib/pg_hint_plan/pg_hint_plan.c @@ -2004,7 +2004,7 @@ get_hints_from_comment(const char *p) { const char *hint_head; char *head; - char *tail; + const char *tail; int len; if (p == NULL) @@ -2051,7 +2051,7 @@ get_hints_from_comment(const char *p) } /* We don't support nested block comments. */ - if ((head = strstr(p, BLOCK_COMMENT_START)) != NULL && head < tail) + if ((head = (char *) strstr(p, BLOCK_COMMENT_START)) != NULL && head < tail) { hint_ereport(head, ("Nested block comments are not supported.")); return NULL; diff --git a/gpcontrib/reject_partition_fullscan/reject_partition_fullscan.c b/gpcontrib/reject_partition_fullscan/reject_partition_fullscan.c index 0a38cfe7b0c..0670c8f6232 100644 --- a/gpcontrib/reject_partition_fullscan/reject_partition_fullscan.c +++ b/gpcontrib/reject_partition_fullscan/reject_partition_fullscan.c @@ -278,7 +278,7 @@ check_dynamic_scan_fullscan(Plan *plan, List *rtable) partOids = ((DynamicSeqScan *) plan)->partOids; join_prune_paramids = ((DynamicSeqScan *) plan)->join_prune_paramids; - scanrelid = ((DynamicSeqScan *) plan)->seqscan.scan.scanrelid; + scanrelid = ((DynamicSeqScan *) plan)->seqscan.scanrelid; break; case T_DynamicIndexScan: partOids = ((DynamicIndexScan *) plan)->partOids; diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c index 58b83e7aa5b..ff90e59c42b 100644 --- a/src/backend/catalog/pg_type.c +++ b/src/backend/catalog/pg_type.c @@ -1066,7 +1066,7 @@ char * makeMultirangeTypeName(const char *rangeTypeName, Oid typeNamespace) { char *buf; - char *rangestr; + const char *rangestr; /* * If the range type name contains "range" then change that to diff --git a/src/backend/cdb/dispatcher/cdbgang.c b/src/backend/cdb/dispatcher/cdbgang.c index 87ce88504b0..5604603ff67 100644 --- a/src/backend/cdb/dispatcher/cdbgang.c +++ b/src/backend/cdb/dispatcher/cdbgang.c @@ -167,7 +167,7 @@ AllocateGang(CdbDispatcherState *ds, GangType type, List *segments) bool segment_failure_due_to_recovery(const char *error_message) { - char *fatal = NULL, + const char *fatal = NULL, *ptr = NULL; int fatal_len = 0; @@ -210,7 +210,7 @@ segment_failure_due_to_recovery(const char *error_message) bool segment_failure_due_to_missing_writer(const char *error_message) { - char *fatal = NULL, + const char *fatal = NULL, *ptr = NULL; int fatal_len = 0; @@ -232,7 +232,7 @@ segment_failure_due_to_missing_writer(const char *error_message) bool segment_failure_due_to_fault_injector(const char *error_message) { - char *fatal = NULL, + const char *fatal = NULL, *ptr = NULL; int fatal_len = 0; diff --git a/src/backend/commands/resgroupcmds.c b/src/backend/commands/resgroupcmds.c index 384675edb7f..b62917cf3eb 100644 --- a/src/backend/commands/resgroupcmds.c +++ b/src/backend/commands/resgroupcmds.c @@ -1567,8 +1567,8 @@ checkCpusetSyntax(const char *cpuset) extern void checkCpuSetByRole(const char *cpuset) { - char *first = NULL; - char *last = NULL; + const char *first = NULL; + const char *last = NULL; if (cpuset == NULL) { @@ -1627,12 +1627,12 @@ getCpuSetByRole(const char *cpuset) errmsg("Unexpected cpuset invalid in getCpuSetByRole"))); } - char *first = strchr(cpuset, ';'); + const char *first = strchr(cpuset, ';'); if (first == NULL) splitcpuset = (char *)cpuset; else { - char *scpu = first + 1; + char *scpu = (char *) (first + 1); /* Get result cpuset by IS_QUERY_DISPATCHER(), on master or segment */ if (IS_QUERY_DISPATCHER()) diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c index fbf0a580413..48ba19f4c29 100644 --- a/src/backend/commands/statscmds.c +++ b/src/backend/commands/statscmds.c @@ -187,8 +187,7 @@ CreateStatistics(CreateStatsStmt *stmt, bool check_rights) { AclResult aclresult; - aclresult = object_aclcheck(NamespaceRelationId, namespaceId, - GetUserId(), ACL_CREATE); + aclresult = pg_namespace_aclcheck(namespaceId, GetUserId(), ACL_CREATE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, OBJECT_SCHEMA, get_namespace_name(namespaceId)); diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c index 9981ed8f7ae..70a2b9062c1 100644 --- a/src/backend/executor/nodeHashjoin.c +++ b/src/backend/executor/nodeHashjoin.c @@ -387,7 +387,22 @@ ExecHashJoinImpl(PlanState *pstate, bool parallel) * If LASJ_NOTIN and a null was found on the inner side, then clean out. */ if (node->js.jointype == JOIN_LASJ_NOTIN && hashNode->hs_hashkeys_null) + { + if (parallel) + { + /* + * Advance the build barrier to PHJ_BUILD_RUNNING + * before proceeding so we can negotiate resource + * cleanup, matching the empty-inner-relation early + * return below. + */ + Barrier *build_barrier = ¶llel_state->build_barrier; + + while (BarrierPhase(build_barrier) < PHJ_BUILD_RUNNING) + BarrierArriveAndWait(build_barrier, 0); + } return NULL; + } /* * If the inner relation is completely empty, and we're not diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index 7ef058779af..6573dea982b 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -813,14 +813,7 @@ get_index_paths(PlannerInfo *root, RelOptInfo *rel, */ if (index->amhasgettuple) { - /* - * PAX shares AO's planner concern: random TID fetch - * re-decompresses whole stripes and bypasses the buffer pool. - * Treat it as AO-like so only Bitmap paths survive add_path - * here. - */ - if ((!AMHandlerIsAO(rel->amhandler) && - !AMHandlerIsPAX(rel->amhandler)) || + if (!AMHandlerIsAO(rel->amhandler) || index->amcostestimate == bmcostestimate) add_path(rel, (Path *) ipath, root); else if (gp_enable_ao_indexscan && !IsA(ipath, IndexOnlyScan)) diff --git a/src/backend/utils/adt/xid8funcs.c b/src/backend/utils/adt/xid8funcs.c index 0c9f14a0c83..086b460d769 100644 --- a/src/backend/utils/adt/xid8funcs.c +++ b/src/backend/utils/adt/xid8funcs.c @@ -214,8 +214,8 @@ is_visible_fxid(FullTransactionId value, const pg_snapshot *snap) { void *res; - res = bsearch(&value, snap->xip, snap->nxip, sizeof(FullTransactionId), - cmp_fxid); + res = (void *) bsearch(&value, snap->xip, snap->nxip, sizeof(FullTransactionId), + cmp_fxid); /* if found, transaction is still in progress */ return (res) ? false : true; } diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c index dde92a64659..ce34eaeaf9f 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -1226,7 +1226,13 @@ static const struct cachedesc cacheinfo[] = { [EXTENSIONOID] = { ExtensionRelationId, ExtensionOidIndexId, - KEY(Anum_pg_extension_oid), + 1, + { + Anum_pg_extension_oid, + 0, + 0, + 0 + }, 2 } }; diff --git a/src/backend/utils/misc/fstream/fstream.c b/src/backend/utils/misc/fstream/fstream.c index 56a730b98ad..0bc26c24dc8 100644 --- a/src/backend/utils/misc/fstream/fstream.c +++ b/src/backend/utils/misc/fstream/fstream.c @@ -433,7 +433,7 @@ static int glob_path(fstream_t *fs, const char *path) while (*path == ' ') path++; - p = strchr(path, ' '); + p = (char *) strchr(path, ' '); if (p) *p++ = 0; diff --git a/src/backend/utils/misc/uriparser.c b/src/backend/utils/misc/uriparser.c index 0ee2ecad847..58cd124ebf5 100644 --- a/src/backend/utils/misc/uriparser.c +++ b/src/backend/utils/misc/uriparser.c @@ -70,7 +70,7 @@ ParseExternalTableUri(const char *uri_str) else /* not recognized. treat it as a custom protocol */ { - char *post_protocol = strstr(uri_str, "://"); + const char *post_protocol = strstr(uri_str, "://"); if(!post_protocol) { diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c index 202d12ae607..9a13e46c7dd 100644 --- a/src/backend/utils/mmgr/mcxt.c +++ b/src/backend/utils/mmgr/mcxt.c @@ -1615,132 +1615,6 @@ repalloc_mul_extended(void *p, Size s1, Size s2, int flags) return repalloc_extended(p, req, flags); } -/* - * Support for safe calculation of memory request sizes - * - * These functions perform the requested calculation, but throw error if the - * result overflows. - * - * An important property of these functions is that if an argument was a - * negative signed int before promotion (implying overflow in calculating it) - * we will detect that as an error. That happens because we reject results - * larger than SIZE_MAX / 2 later on, in the actual allocation step. - */ -Size -add_size(Size s1, Size s2) -{ - Size result; - - if (unlikely(pg_add_size_overflow(s1, s2, &result))) - add_size_error(s1, s2); - return result; -} - -static pg_noinline void -add_size_error(Size s1, Size s2) -{ - ereport(ERROR, - (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("invalid memory allocation request size %zu + %zu", - s1, s2))); -} - -Size -mul_size(Size s1, Size s2) -{ - Size result; - - if (unlikely(pg_mul_size_overflow(s1, s2, &result))) - mul_size_error(s1, s2); - return result; -} - -static pg_noinline void -mul_size_error(Size s1, Size s2) -{ - ereport(ERROR, - (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("invalid memory allocation request size %zu * %zu", - s1, s2))); -} - -/* - * palloc_mul - * Equivalent to palloc(mul_size(s1, s2)). - */ -void * -palloc_mul(Size s1, Size s2) -{ - /* inline mul_size() for efficiency */ - Size req; - - if (unlikely(pg_mul_size_overflow(s1, s2, &req))) - mul_size_error(s1, s2); - return palloc(req); -} - -/* - * palloc0_mul - * Equivalent to palloc0(mul_size(s1, s2)). - * - * This is comparable to standard calloc's behavior. - */ -void * -palloc0_mul(Size s1, Size s2) -{ - /* inline mul_size() for efficiency */ - Size req; - - if (unlikely(pg_mul_size_overflow(s1, s2, &req))) - mul_size_error(s1, s2); - return palloc0(req); -} - -/* - * palloc_mul_extended - * Equivalent to palloc_extended(mul_size(s1, s2), flags). - */ -void * -palloc_mul_extended(Size s1, Size s2, int flags) -{ - /* inline mul_size() for efficiency */ - Size req; - - if (unlikely(pg_mul_size_overflow(s1, s2, &req))) - mul_size_error(s1, s2); - return palloc_extended(req, flags); -} - -/* - * repalloc_mul - * Equivalent to repalloc(p, mul_size(s1, s2)). - */ -void * -repalloc_mul(void *p, Size s1, Size s2) -{ - /* inline mul_size() for efficiency */ - Size req; - - if (unlikely(pg_mul_size_overflow(s1, s2, &req))) - mul_size_error(s1, s2); - return repalloc(p, req); -} - -/* - * repalloc_mul_extended - * Equivalent to repalloc_extended(p, mul_size(s1, s2), flags). - */ -void * -repalloc_mul_extended(void *p, Size s1, Size s2, int flags) -{ - /* inline mul_size() for efficiency */ - Size req; - - if (unlikely(pg_mul_size_overflow(s1, s2, &req))) - mul_size_error(s1, s2); - return repalloc_extended(p, req, flags); -} - /* * MemoryContextAllocHuge * Allocate (possibly-expansive) space within the specified context. diff --git a/src/bin/gpfdist/gpfdist.c b/src/bin/gpfdist/gpfdist.c index ad7fb868313..cba0639260a 100644 --- a/src/bin/gpfdist/gpfdist.c +++ b/src/bin/gpfdist/gpfdist.c @@ -3774,7 +3774,7 @@ static int request_set_transform(request_t *r) */ char* param = "#transform="; - char* start = strstr(r->path, param); + char* start = (char *) strstr(r->path, param); if (start) { /* diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c index a24283405d2..748f167c618 100644 --- a/src/bin/pg_waldump/pg_waldump.c +++ b/src/bin/pg_waldump/pg_waldump.c @@ -107,7 +107,7 @@ verify_directory(const char *directory) static void split_path(const char *path, char **dir, char **fname) { - char *sep; + const char *sep; /* split filepath into directory & filename */ sep = strrchr(path, '/'); diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index c87bc3dd007..5e28713be1d 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -5467,7 +5467,7 @@ findBuiltin(const char *name) static int parseScriptWeight(const char *option, char **script) { - char *sep; + const char *sep; int weight; if ((sep = strrchr(option, WSEP))) diff --git a/src/include/common/fe_memutils.h b/src/include/common/fe_memutils.h index c906f564d5c..ff25bccdf5d 100644 --- a/src/include/common/fe_memutils.h +++ b/src/include/common/fe_memutils.h @@ -51,16 +51,6 @@ extern void *pg_malloc0_mul(Size s1, Size s2); extern void *pg_malloc_mul_extended(Size s1, Size s2, int flags); extern void *pg_realloc_mul(void *p, Size s1, Size s2); -/* - * Support for safe calculation of memory request sizes - */ -extern Size add_size(Size s1, Size s2); -extern Size mul_size(Size s1, Size s2); -extern void *pg_malloc_mul(Size s1, Size s2); -extern void *pg_malloc0_mul(Size s1, Size s2); -extern void *pg_malloc_mul_extended(Size s1, Size s2, int flags); -extern void *pg_realloc_mul(void *p, Size s1, Size s2); - /* * Variants with easier notation and more type safety */ diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index 0f61a3ae8b9..0b39f8e760d 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -277,6 +277,65 @@ extern int errFatalReturn(bool fatalReturn); /* GPDB: true => return on FATAL er ereport(elevel, errmsg_internal(__VA_ARGS__)) +/*---------- + * Support for reporting "soft" errors that don't require a full transaction + * abort to clean up. This is to be used in this way: + * errsave(context, + * errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + * errmsg("invalid input syntax for type %s: \"%s\"", + * "boolean", in_str), + * ... other errxxx() fields as needed ...); + * + * "context" is a node pointer or NULL, and the remaining auxiliary calls + * provide the same error details as in ereport(). If context is not a + * pointer to an ErrorSaveContext node, then errsave(context, ...) + * behaves identically to ereport(ERROR, ...). If context is a pointer + * to an ErrorSaveContext node, then the information provided by the + * auxiliary calls is stored in the context node and control returns + * normally. The caller of errsave() must then do any required cleanup + * and return control back to its caller. That caller must check the + * ErrorSaveContext node to see whether an error occurred before + * it can trust the function's result to be meaningful. + * + * errsave_domain() allows a message domain to be specified; it is + * precisely analogous to ereport_domain(). + *---------- + */ +struct Node; /* #include "nodes/nodes.h" */ + +#define errsave_domain(context, domain, ...) \ + do { \ + struct Node *context_ = (context); \ + pg_prevent_errno_in_scope(); \ + if (errsave_start(context_, domain)) \ + __VA_ARGS__, errsave_finish(context_, __FILE__, __LINE__, __func__); \ + } while(0) + +#define errsave(context, ...) \ + errsave_domain(context, TEXTDOMAIN, __VA_ARGS__) + +/* + * "ereturn(context, dummy_value, ...);" is exactly the same as + * "errsave(context, ...); return dummy_value;". This saves a bit + * of typing in the common case where a function has no cleanup + * actions to take after reporting a soft error. "dummy_value" + * can be empty if the function returns void. + */ +#define ereturn_domain(context, dummy_value, domain, ...) \ + do { \ + errsave_domain(context, domain, __VA_ARGS__); \ + return dummy_value; \ + } while(0) + +#define ereturn(context, dummy_value, ...) \ + ereturn_domain(context, dummy_value, TEXTDOMAIN, __VA_ARGS__) + +extern bool errsave_start(struct Node *context, const char *domain); +extern void errsave_finish(struct Node *context, + const char *filename, int lineno, + const char *funcname); + + /* Support for constructing error strings separately from ereport() calls */ extern void pre_format_elog_string(int errnumber, const char *domain); diff --git a/src/include/utils/tarrable.h b/src/include/utils/tarrable.h index 1540fa5a70b..704e0b42052 100644 --- a/src/include/utils/tarrable.h +++ b/src/include/utils/tarrable.h @@ -14,7 +14,7 @@ #ifndef TARRABLE_H #define TARRABLE_H -#define MAX_TARABLE_SYMLINK_PATH_LENGTH 100 +#define MAX_TARABLE_SYMLINK_PATH_LENGTH 200 #endif /* TARRABLE_H */ diff --git a/src/interfaces/ecpg/pgtypeslib/datetime.c b/src/interfaces/ecpg/pgtypeslib/datetime.c index 1b253747fc4..1fb3ab041fc 100644 --- a/src/interfaces/ecpg/pgtypeslib/datetime.c +++ b/src/interfaces/ecpg/pgtypeslib/datetime.c @@ -336,7 +336,7 @@ PGTYPESdate_defmt_asc(date * d, const char *fmt, const char *str) int token[3][2]; int token_values[3] = {-1, -1, -1}; char *fmt_token_order; - char *fmt_ystart, + const char *fmt_ystart, *fmt_mstart, *fmt_dstart; unsigned int i; diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 02fec8d0366..07076e8f6d9 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -5164,9 +5164,9 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (values[i]->bv_len >= INT_MAX || size > (INT_MAX - (values[i]->bv_len + 1))) { - libpq_append_error(errorMessage, - "connection info string size exceeds the maximum allowed (%d)", - INT_MAX); + appendPQExpBuffer(errorMessage, + libpq_gettext("connection info string size exceeds the maximum allowed (%d)\n"), + INT_MAX); ldap_value_free_len(values); ldap_unbind(ld); return 3; diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 7078f653cc6..eb95ffde54f 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -4307,9 +4307,9 @@ PQescapeInternal(PGconn *conn, const char *str, size_t len, bool as_ident) return result; overflow: - libpq_append_conn_error(conn, - "escaped string size exceeds the maximum allowed (%zu)", - SIZE_MAX); + appendPQExpBuffer(&conn->errorMessage, + libpq_gettext("escaped string size exceeds the maximum allowed (%zu)\n"), + SIZE_MAX); return NULL; } @@ -4485,9 +4485,9 @@ PQescapeByteaInternal(PGconn *conn, overflow: if (conn) - libpq_append_conn_error(conn, - "escaped bytea size exceeds the maximum allowed (%zu)", - SIZE_MAX); + appendPQExpBuffer(&conn->errorMessage, + libpq_gettext("escaped bytea size exceeds the maximum allowed (%zu)\n"), + SIZE_MAX); return NULL; } diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile index 60f8d491efb..f69a785771f 100644 --- a/src/test/regress/GNUmakefile +++ b/src/test/regress/GNUmakefile @@ -63,6 +63,7 @@ $(top_builddir)/src/port/pg_config_paths.h: | submake-libpgport install: all installdirs $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)' $(INSTALL_PROGRAM) regress.so '$(DESTDIR)$(pkglibdir)/regress.so' + $(INSTALL_PROGRAM) regress.so '$(DESTDIR)$(pkglibdir)/refint.so' $(INSTALL_PROGRAM) gpdiff.pl '$(DESTDIR)$(pgxsdir)/$(subdir)/gpdiff.pl' $(INSTALL_PROGRAM) gpstringsubs.pl '$(DESTDIR)$(pgxsdir)/$(subdir)/gpstringsubs.pl' $(INSTALL_PROGRAM) atmsort.pl '$(DESTDIR)$(pgxsdir)/$(subdir)/atmsort.pl' @@ -79,6 +80,7 @@ installdirs: uninstall: rm -f '$(DESTDIR)$(pkglibdir)/regress.so' + rm -f '$(DESTDIR)$(pkglibdir)/refint.so' rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)' rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/gpdiff.pl' rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/gpstringsubs.pl' diff --git a/src/test/regress/expected/dboptions.out b/src/test/regress/expected/dboptions.out index b035fc62661..15654fbc3a3 100644 --- a/src/test/regress/expected/dboptions.out +++ b/src/test/regress/expected/dboptions.out @@ -29,7 +29,7 @@ order by gp_segment_id; -- this by ensuring that a multi-slice plan, exceeding the connection limit on -- the segment can execute. \! psql -h /tmp limitdb -U connlimit_test_user -c 'create table tbl(i int);' -NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table. +NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Apache Cloudberry data distribution key for this table. HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew. CREATE TABLE \! psql -h /tmp limitdb -U connlimit_test_user -c 'select count(*) from tbl t1, tbl t2;' diff --git a/src/test/regress/expected/stats_ext.out b/src/test/regress/expected/stats_ext.out index f84cd12b57b..a6e0fe0cae3 100644 --- a/src/test/regress/expected/stats_ext.out +++ b/src/test/regress/expected/stats_ext.out @@ -3361,13 +3361,18 @@ GRANT USAGE ON SCHEMA sts_sch1, sts_sch2 TO regress_stats_user1; ALTER TABLE sts_sch1.tbl OWNER TO regress_stats_user1; SET SESSION AUTHORIZATION regress_stats_user1; CREATE STATISTICS ON a, b FROM sts_sch1.tbl; -ERROR: permission denied for schema sts_sch1 +ERROR: syntax error at or near "ON" +LINE 1: CREATE STATISTICS ON a, b FROM sts_sch1.tbl; + ^ CREATE STATISTICS sts_sch2.fail ON a, b FROM sts_sch1.tbl; ERROR: permission denied for schema sts_sch2 RESET SESSION AUTHORIZATION; GRANT CREATE ON SCHEMA sts_sch1 TO regress_stats_user1; SET SESSION AUTHORIZATION regress_stats_user1; CREATE STATISTICS ON a, b FROM sts_sch1.tbl; +ERROR: syntax error at or near "ON" +LINE 1: CREATE STATISTICS ON a, b FROM sts_sch1.tbl; + ^ CREATE STATISTICS sts_sch2.fail ON a, b FROM sts_sch1.tbl; ERROR: permission denied for schema sts_sch2 RESET SESSION AUTHORIZATION; @@ -3375,12 +3380,17 @@ REVOKE CREATE ON SCHEMA sts_sch1 FROM regress_stats_user1; GRANT CREATE ON SCHEMA sts_sch2 TO regress_stats_user1; SET SESSION AUTHORIZATION regress_stats_user1; CREATE STATISTICS ON a, b FROM sts_sch1.tbl; -ERROR: permission denied for schema sts_sch1 +ERROR: syntax error at or near "ON" +LINE 1: CREATE STATISTICS ON a, b FROM sts_sch1.tbl; + ^ CREATE STATISTICS sts_sch2.pass1 ON a, b FROM sts_sch1.tbl; RESET SESSION AUTHORIZATION; GRANT CREATE ON SCHEMA sts_sch1, sts_sch2 TO regress_stats_user1; SET SESSION AUTHORIZATION regress_stats_user1; CREATE STATISTICS ON a, b FROM sts_sch1.tbl; +ERROR: syntax error at or near "ON" +LINE 1: CREATE STATISTICS ON a, b FROM sts_sch1.tbl; + ^ CREATE STATISTICS sts_sch2.pass2 ON a, b FROM sts_sch1.tbl; -- re-creating statistics via ALTER TABLE bypasses checks for CREATE on schema RESET SESSION AUTHORIZATION; diff --git a/src/test/regress/expected/stats_ext_optimizer.out b/src/test/regress/expected/stats_ext_optimizer.out index 8358251bc27..9f81688283e 100644 --- a/src/test/regress/expected/stats_ext_optimizer.out +++ b/src/test/regress/expected/stats_ext_optimizer.out @@ -3396,13 +3396,18 @@ GRANT USAGE ON SCHEMA sts_sch1, sts_sch2 TO regress_stats_user1; ALTER TABLE sts_sch1.tbl OWNER TO regress_stats_user1; SET SESSION AUTHORIZATION regress_stats_user1; CREATE STATISTICS ON a, b FROM sts_sch1.tbl; -ERROR: permission denied for schema sts_sch1 +ERROR: syntax error at or near "ON" +LINE 1: CREATE STATISTICS ON a, b FROM sts_sch1.tbl; + ^ CREATE STATISTICS sts_sch2.fail ON a, b FROM sts_sch1.tbl; ERROR: permission denied for schema sts_sch2 RESET SESSION AUTHORIZATION; GRANT CREATE ON SCHEMA sts_sch1 TO regress_stats_user1; SET SESSION AUTHORIZATION regress_stats_user1; CREATE STATISTICS ON a, b FROM sts_sch1.tbl; +ERROR: syntax error at or near "ON" +LINE 1: CREATE STATISTICS ON a, b FROM sts_sch1.tbl; + ^ CREATE STATISTICS sts_sch2.fail ON a, b FROM sts_sch1.tbl; ERROR: permission denied for schema sts_sch2 RESET SESSION AUTHORIZATION; @@ -3410,12 +3415,17 @@ REVOKE CREATE ON SCHEMA sts_sch1 FROM regress_stats_user1; GRANT CREATE ON SCHEMA sts_sch2 TO regress_stats_user1; SET SESSION AUTHORIZATION regress_stats_user1; CREATE STATISTICS ON a, b FROM sts_sch1.tbl; -ERROR: permission denied for schema sts_sch1 +ERROR: syntax error at or near "ON" +LINE 1: CREATE STATISTICS ON a, b FROM sts_sch1.tbl; + ^ CREATE STATISTICS sts_sch2.pass1 ON a, b FROM sts_sch1.tbl; RESET SESSION AUTHORIZATION; GRANT CREATE ON SCHEMA sts_sch1, sts_sch2 TO regress_stats_user1; SET SESSION AUTHORIZATION regress_stats_user1; CREATE STATISTICS ON a, b FROM sts_sch1.tbl; +ERROR: syntax error at or near "ON" +LINE 1: CREATE STATISTICS ON a, b FROM sts_sch1.tbl; + ^ CREATE STATISTICS sts_sch2.pass2 ON a, b FROM sts_sch1.tbl; -- re-creating statistics via ALTER TABLE bypasses checks for CREATE on schema RESET SESSION AUTHORIZATION; diff --git a/src/test/regress/gpdiff.pl b/src/test/regress/gpdiff.pl index c3a4c200ca9..3a9d562f36f 100755 --- a/src/test/regress/gpdiff.pl +++ b/src/test/regress/gpdiff.pl @@ -252,7 +252,7 @@ if (1) "man" => sub { lazy_pod2usage(-msg => $pmsg, -exitstatus => 0, -verbose => 2) }, "help" => sub { lazy_pod2usage(-msg => $pmsg, -exitstatus => 1) }, "version|v" => \&print_version , - "verbose|Verbose" => \$glob_atmsort_args{VERBOSE}, + "verbose" => \$glob_atmsort_args{VERBOSE}, "gpd_ignore_plans|gp_ignore_plans" => \$glob_atmsort_args{IGNORE_PLANS}, "gpd_init|gp_init_file=s" => \@{$glob_atmsort_args{INIT_FILES}} ); diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index c9921aaf5ce..1d3d843a46d 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -1073,8 +1073,8 @@ char * get_expectfile(const char *testname, const char *file, const char *default_expectfile) { char expectpath[MAXPGPATH]; - char *file_type; - char *file_name; + const char *file_type; + const char *file_name; char base_file[MAXPGPATH]; _resultmap *rm; char buf[MAXPGPATH]; @@ -1105,7 +1105,7 @@ get_expectfile(const char *testname, const char *file, const char *default_expec * up to the last slash. */ { - char *p = strrchr(default_expectfile, '/'); + const char *p = strrchr(default_expectfile, '/'); if (!p) return NULL; diff --git a/src/test/regress/scan_flaky_fault_injectors.sh b/src/test/regress/scan_flaky_fault_injectors.sh index 8fe97655444..cbc47187cab 100755 --- a/src/test/regress/scan_flaky_fault_injectors.sh +++ b/src/test/regress/scan_flaky_fault_injectors.sh @@ -7,6 +7,12 @@ set -e +# Use the C locale for sort/comm below: comm requires its inputs to be +# sorted in the exact same collation it uses for comparison, and +# locale-aware collation (e.g. en_US.UTF-8) is not guaranteed to produce +# output that's self-consistent under strict byte-order comparison. +export LC_ALL=C + fault_injection_tests=$(mktemp fault_injection_tests.XXX) parallel_tests=$(mktemp parallel_tests.XXX) retcode=0 diff --git a/src/timezone/zic.c b/src/timezone/zic.c index 7548bb76a7f..16d96e70240 100644 --- a/src/timezone/zic.c +++ b/src/timezone/zic.c @@ -2636,7 +2636,7 @@ doabbr(char *abbr, struct zone const *zp, char const *letters, bool isdst, zic_t save, bool doquotes) { char *cp; - char *slashp; + char const *slashp; size_t len; char const *format = zp->z_format; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
