This is an automated email from the ASF dual-hosted git repository.

chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/cbdb-postgres-merge by this 
push:
     new a9cb8243841 Fix compile errors for interfaces/libpq
a9cb8243841 is described below

commit a9cb8243841df07e39122b09479bcb2682a3c325
Author: Jinbao Chen <[email protected]>
AuthorDate: Tue Oct 7 22:59:22 2025 +0800

    Fix compile errors for interfaces/libpq
---
 src/Makefile.shlib                       |  26 -----
 src/interfaces/libpq/Makefile            |   4 -
 src/interfaces/libpq/exports.txt         |   3 -
 src/interfaces/libpq/fe-connect.c        | 171 +++++--------------------------
 src/interfaces/libpq/fe-exec.c           | 150 ---------------------------
 src/interfaces/libpq/fe-misc.c           |  37 -------
 src/interfaces/libpq/fe-print.c          |  20 ----
 src/interfaces/libpq/fe-protocol3.c      |   2 +-
 src/interfaces/libpq/fe-secure-openssl.c |  20 ----
 src/interfaces/libpq/libpq-int.h         |   2 +-
 src/interfaces/libpq/nls.mk              |   7 --
 src/interfaces/libpq/pqexpbuffer.c       |   9 --
 12 files changed, 28 insertions(+), 423 deletions(-)

diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index c06c728c8f6..f94d59d1c59 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -305,32 +305,6 @@ $(exports_file): $(SHLIB_EXPORTS)
 endif
 endif
 
-<<<<<<< HEAD
-else # PORTNAME == aix
-
-# AIX case
-
-# See notes in src/backend/parser/Makefile about the following two rules
-$(stlib): $(shlib)
-       touch $@
-
-$(shlib): $(OBJS) | $(SHLIB_PREREQS)
-       rm -f $(stlib)
-       $(LINK.static) $(stlib) $^
-       $(RANLIB) $(stlib)
-ifeq (,$(SHLIB_EXPORTS))
-       $(MKLDEXPORT) $(stlib) $(shlib) >$(exports_file)
-else
-       ( echo '#! $(shlib)'; $(AWK) '/^[^#]/ {printf "%s\n",$$1}' 
$(SHLIB_EXPORTS) ) >$(exports_file)
-endif
-       $(COMPILER) -o $(shlib) $(stlib) -Wl,-bE:$(exports_file) $(LDFLAGS) 
$(LDFLAGS_SL) $(SHLIB_LINK)
-       rm -f $(stlib)
-       $(AR) $(AROPT) $(stlib) $(shlib)
-
-endif # PORTNAME == aix
-
-=======
->>>>>>> REL_16_9
 else # PORTNAME == cygwin || PORTNAME == win32
 
 ifeq ($(PORTNAME), cygwin)
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index 3d1a7088f97..0919d8f32f6 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -96,11 +96,7 @@ SHLIB_PREREQS = submake-libpgport
 SHLIB_EXPORTS = exports.txt
 
 ifeq ($(with_ssl),openssl)
-<<<<<<< HEAD
-PKG_CONFIG_REQUIRES_PRIVATE = libssl libcrypto
-=======
 PKG_CONFIG_REQUIRES_PRIVATE = libssl, libcrypto
->>>>>>> REL_16_9
 endif
 
 all: all-lib libpq-refs-stamp
diff --git a/src/interfaces/libpq/exports.txt b/src/interfaces/libpq/exports.txt
index 4952b9f2f22..7ded77aff37 100644
--- a/src/interfaces/libpq/exports.txt
+++ b/src/interfaces/libpq/exports.txt
@@ -186,7 +186,4 @@ PQpipelineStatus          183
 PQsetTraceFlags           184
 PQmblenBounded            185
 PQsendFlushRequest        186
-<<<<<<< HEAD
-=======
 PQconnectionUsedGSSAPI    187
->>>>>>> REL_16_9
diff --git a/src/interfaces/libpq/fe-connect.c 
b/src/interfaces/libpq/fe-connect.c
index 7384bf42a7e..135af368f84 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -3,12 +3,8 @@
  * fe-connect.c
  *       functions related to setting up a connection to the backend
  *
-<<<<<<< HEAD
  * Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
@@ -405,7 +401,11 @@ static const internalPQconninfoOption PQconninfoOptions[] 
= {
                "Target-Session-Attrs", "", 15, /* sizeof("prefer-standby") = 
15 */
        offsetof(struct pg_conn, target_session_attrs)},
 
-<<<<<<< HEAD
+       {"load_balance_hosts", "PGLOADBALANCEHOSTS",
+        DefaultLoadBalanceHosts, NULL,
+        "Load-Balance-Hosts", "", 8,   /* sizeof("disable") = 8 */
+        offsetof(struct pg_conn, load_balance_hosts)},
+
     /* CDB: qExec wants some info from qDisp before GUCs are processed */
        {"gpqeid", NULL, "", NULL,
                "gp-debug-qeid", "D", 40,
@@ -418,12 +418,6 @@ static const internalPQconninfoOption PQconninfoOptions[] 
= {
        {"diff_options", NULL, NULL, NULL,
                "updated synced GUCs", "D", 80,
        offsetof(struct pg_conn, diffoptions)},
-=======
-       {"load_balance_hosts", "PGLOADBALANCEHOSTS",
-               DefaultLoadBalanceHosts, NULL,
-               "Load-Balance-Hosts", "", 8,    /* sizeof("disable") = 8 */
-       offsetof(struct pg_conn, load_balance_hosts)},
->>>>>>> REL_16_9
 
        /* Terminating entry --- MUST BE LAST */
        {NULL, NULL, NULL, NULL,
@@ -1224,21 +1218,12 @@ connectOptions2(PGconn *conn)
                }
                else
                {
-<<<<<<< HEAD
-                       if (ch->host)
-                               free(ch->host);
-=======
                        free(ch->host);
->>>>>>> REL_16_9
 
                        /*
                         * This bit selects the default host location.  If you 
change
                         * this, see also pg_regress.
                         */
-<<<<<<< HEAD
-#ifdef HAVE_UNIX_SOCKETS
-=======
->>>>>>> REL_16_9
                        if (DEFAULT_PGSOCKET_DIR[0])
                        {
                                ch->host = strdup(DEFAULT_PGSOCKET_DIR);
@@ -3520,12 +3505,7 @@ keep_going:                                              
/* We will come back to here until there is
                                         */
                                        if (conn->inCursor != conn->inEnd)
                                        {
-<<<<<<< HEAD
-                                               
appendPQExpBufferStr(&conn->errorMessage,
-                                                                               
         libpq_gettext("received unencrypted data after SSL response\n"));
-=======
                                                libpq_append_conn_error(conn, 
"received unencrypted data after SSL response");
->>>>>>> REL_16_9
                                                goto error_return;
                                        }
 
@@ -3634,12 +3614,7 @@ keep_going:                                              
/* We will come back to here until there is
                                         */
                                        if (conn->inCursor != conn->inEnd)
                                        {
-<<<<<<< HEAD
-                                               
appendPQExpBufferStr(&conn->errorMessage,
-                                                                               
         libpq_gettext("received unencrypted data after GSSAPI encryption 
response\n"));
-=======
                                                libpq_append_conn_error(conn, 
"received unencrypted data after GSSAPI encryption response");
->>>>>>> REL_16_9
                                                goto error_return;
                                        }
 
@@ -4142,11 +4117,7 @@ keep_going:                                              
/* We will come back to here until there is
                                 * (and it seems some clients expect it to be 
empty after a
                                 * successful connection).
                                 */
-<<<<<<< HEAD
-                               resetPQExpBuffer(&conn->errorMessage);
-=======
                                pqClearConnErrorState(conn);
->>>>>>> REL_16_9
 
                                /* We are open for business! */
                                conn->status = CONNECTION_OK;
@@ -4499,9 +4470,6 @@ makeEmptyPGconn(void)
 static void
 freePGconn(PGconn *conn)
 {
-<<<<<<< HEAD
-       int                     i;
-
        if (!conn)
                return;
 
@@ -4512,8 +4480,6 @@ freePGconn(PGconn *conn)
                closesocket(conn->sock);
        }
 
-=======
->>>>>>> REL_16_9
        /* let any event procs clean up their state data */
        for (int i = 0; i < conn->nEvents; i++)
        {
@@ -4571,35 +4537,25 @@ freePGconn(PGconn *conn)
                explicit_bzero(conn->sslpassword, strlen(conn->sslpassword));
                free(conn->sslpassword);
        }
-<<<<<<< HEAD
-       if (conn->sslrootcert)
-               free(conn->sslrootcert);
-       if (conn->sslcrl)
-               free(conn->sslcrl);
-       if (conn->sslcrldir)
-               free(conn->sslcrldir);
-       if (conn->sslcompression)
-               free(conn->sslcompression);
-       if (conn->sslsni)
-               free(conn->sslsni);
-       if (conn->requirepeer)
-               free(conn->requirepeer);
-       if (conn->ssl_min_protocol_version)
-               free(conn->ssl_min_protocol_version);
-       if (conn->ssl_max_protocol_version)
-               free(conn->ssl_max_protocol_version);
-       if (conn->gssencmode)
-               free(conn->gssencmode);
+       free(conn->sslcertmode);
+       free(conn->sslrootcert);
+       free(conn->sslcrl);
+       free(conn->sslcrldir);
+       free(conn->sslcompression);
+       free(conn->sslsni);
+       free(conn->requirepeer);
+       free(conn->require_auth);
+       free(conn->ssl_min_protocol_version);
+       free(conn->ssl_max_protocol_version);
+       free(conn->gssencmode);
 #if defined(ENABLE_GSS) || defined(ENABLE_SSPI)
-       if (conn->krbsrvname)
-               free(conn->krbsrvname);
+       free(conn->krbsrvname);
 #endif
-       if (conn->gsslib)
-               free(conn->gsslib);
-       if (conn->gpconntype)
-               free(conn->gpconntype);
-       if (conn->connip)
-               free(conn->connip);
+       free(conn->gpqeid);
+       free(conn->gsslib);
+       free(conn->gpconntype);
+       free(conn->gssdelegation);
+       free(conn->connip);
 #ifdef ENABLE_GSS
        if (conn->gcred != GSS_C_NO_CREDENTIAL)
        {
@@ -4616,40 +4572,6 @@ freePGconn(PGconn *conn)
                conn->gctx = NULL;
        }
 #endif
-#if defined(ENABLE_GSS) && defined(ENABLE_SSPI)
-       if (conn->gsslib)
-               free(conn->gsslib);
-#endif
-       if (conn->gpqeid)                       /* CDB */
-               free(conn->gpqeid);
-
-       /* Note that conn->Pfdebug is not ours to close or free */
-       if (conn->write_err_msg)
-               free(conn->write_err_msg);
-       if (conn->inBuffer)
-               free(conn->inBuffer);
-       if (conn->outBuffer && !conn->outBuffer_shared)
-               free(conn->outBuffer);
-       if (conn->rowBuf)
-               free(conn->rowBuf);
-       if (conn->target_session_attrs)
-               free(conn->target_session_attrs);
-=======
-       free(conn->sslcertmode);
-       free(conn->sslrootcert);
-       free(conn->sslcrl);
-       free(conn->sslcrldir);
-       free(conn->sslcompression);
-       free(conn->sslsni);
-       free(conn->requirepeer);
-       free(conn->require_auth);
-       free(conn->ssl_min_protocol_version);
-       free(conn->ssl_max_protocol_version);
-       free(conn->gssencmode);
-       free(conn->krbsrvname);
-       free(conn->gsslib);
-       free(conn->gssdelegation);
-       free(conn->connip);
        /* Note that conn->Pfdebug is not ours to close or free */
        free(conn->write_err_msg);
        free(conn->inBuffer);
@@ -4657,7 +4579,6 @@ freePGconn(PGconn *conn)
        free(conn->rowBuf);
        free(conn->target_session_attrs);
        free(conn->load_balance_hosts);
->>>>>>> REL_16_9
        termPQExpBuffer(&conn->errorMessage);
        termPQExpBuffer(&conn->workBuffer);
 
@@ -5012,14 +4933,8 @@ optional_setsockopt(int fd, int protoid, int optid, int 
value)
  * error messages with strcpy/strcat is tedious but should be quite safe.
  * We also save/restore errno in case the signal handler support doesn't.
  */
-<<<<<<< HEAD
 static int
-internal_cancel(SockAddr *raddr, int be_pid, int be_key,
-                               char *errbuf, int errbufsize, bool 
requestFinish)
-=======
-int
-PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
->>>>>>> REL_16_9
+PQcancel_internal(PGcancel *cancel, char *errbuf, int errbufsize,  bool 
requestFinish)
 {
        int                     save_errno = SOCK_ERRNO;
        pgsocket        tmpsock = PGINVALID_SOCKET;
@@ -5030,14 +4945,13 @@ PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
                CancelRequestPacket cp;
        }                       crp;
 
-<<<<<<< HEAD
 #ifndef WIN32
        struct pollfd   pollFds[1];
        int                             pollRet;
 
 retry2:
 #endif
-=======
+
        if (!cancel)
        {
                strlcpy(errbuf, "PQcancel() -- no cancel object supplied", 
errbufsize);
@@ -5046,7 +4960,6 @@ retry2:
                return false;
        }
 
->>>>>>> REL_16_9
        /*
         * We need to open a temporary connection to the postmaster. Do this 
with
         * only kernel calls.
@@ -5142,18 +5055,12 @@ retry3:
        /* Create and send the cancel request packet. */
 
        crp.packetlen = pg_hton32((uint32) sizeof(crp));
-<<<<<<< HEAD
        if (requestFinish)
                crp.cp.cancelRequestCode = (MsgType) 
pg_hton32(FINISH_REQUEST_CODE);
        else
                crp.cp.cancelRequestCode = (MsgType) 
pg_hton32(CANCEL_REQUEST_CODE);
-       crp.cp.backendPID = pg_hton32(be_pid);
-       crp.cp.cancelAuthCode = pg_hton32(be_key);
-=======
-       crp.cp.cancelRequestCode = (MsgType) pg_hton32(CANCEL_REQUEST_CODE);
        crp.cp.backendPID = pg_hton32(cancel->be_pid);
        crp.cp.cancelAuthCode = pg_hton32(cancel->be_key);
->>>>>>> REL_16_9
 
 retry4:
        if (send(tmpsock, (char *) &crp, sizeof(crp), 0) != (int) sizeof(crp))
@@ -5254,27 +5161,10 @@ cancel_errReturn:
        return false;
 }
 
-<<<<<<< HEAD
-/*
- * PQcancel: request query cancel
- *
- * Returns true if able to send the cancel request, false if not.
- *
- * On failure, an error message is stored in *errbuf, which must be of size
- * errbufsize (recommended size is 256 bytes).  *errbuf is not changed on
- * success return.
- */
 int
 PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
 {
-       if (!cancel)
-       {
-               strlcpy(errbuf, "PQcancel() -- no cancel object supplied", 
errbufsize);
-               return false;
-       }
-
-       return internal_cancel(&cancel->raddr, cancel->be_pid, cancel->be_key,
-                                                  errbuf, errbufsize, false);
+       return PQcancel_internal(cancel, errbuf, errbufsize, false);
 }
 
 /*
@@ -5292,11 +5182,8 @@ PQrequestFinish(PGcancel *cancel, char *errbuf, int 
errbufsize)
                return false;
        }
 
-       return internal_cancel(&cancel->raddr, cancel->be_pid, cancel->be_key,
-                                                  errbuf, errbufsize, true);
+       return PQcancel_internal(cancel, errbuf, errbufsize, true);
 }
-=======
->>>>>>> REL_16_9
 
 /*
  * PQrequestCancel: old, not thread-safe function for requesting query cancel
@@ -5331,11 +5218,6 @@ PQrequestCancel(PGconn *conn)
                return false;
        }
 
-<<<<<<< HEAD
-       r = internal_cancel(&conn->raddr, conn->be_pid, conn->be_key,
-                                               conn->errorMessage.data, 
conn->errorMessage.maxlen,
-                                               false);
-=======
        cancel = PQgetCancel(conn);
        if (cancel)
        {
@@ -5349,7 +5231,6 @@ PQrequestCancel(PGconn *conn)
                                conn->errorMessage.maxlen);
                r = false;
        }
->>>>>>> REL_16_9
 
        if (!r)
        {
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index db785707059..e9525492d78 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -3,12 +3,8 @@
  * fe-exec.c
  *       functions related to sending a query down to the backend
  *
-<<<<<<< HEAD
  * Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
@@ -230,12 +226,8 @@ PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
                                /* non-error cases */
                                break;
                        default:
-<<<<<<< HEAD
-                               pqSetResultError(result, &conn->errorMessage);
-=======
                                /* we intentionally do not use or modify 
errorReported here */
                                pqSetResultError(result, &conn->errorMessage, 
0);
->>>>>>> REL_16_9
                                break;
                }
 
@@ -718,11 +710,7 @@ pqResultStrdup(PGresult *res, const char *str)
  * (it's caller's responsibility that offset is valid)
  */
 void
-<<<<<<< HEAD
-pqSetResultError(PGresult *res, PQExpBuffer errorMessage)
-=======
 pqSetResultError(PGresult *res, PQExpBuffer errorMessage, int offset)
->>>>>>> REL_16_9
 {
        char       *msg;
 
@@ -737,11 +725,7 @@ pqSetResultError(PGresult *res, PQExpBuffer errorMessage, 
int offset)
         * at a constant "out of memory" string.
         */
        if (!PQExpBufferBroken(errorMessage))
-<<<<<<< HEAD
-               msg = pqResultStrdup(res, errorMessage->data);
-=======
                msg = pqResultStrdup(res, errorMessage->data + offset);
->>>>>>> REL_16_9
        else
                msg = NULL;
        if (msg)
@@ -1429,17 +1413,11 @@ pqAppendCmdQueueEntry(PGconn *conn, PGcmdQueueEntry 
*entry)
                         * itself consume commands from the queue; if we're in 
any other
                         * state, we don't have to do anything.
                         */
-<<<<<<< HEAD
                        if (conn->asyncStatus == PGASYNC_IDLE)
                        {
                                resetPQExpBuffer(&conn->errorMessage);
                                pqPipelineProcessQueue(conn);
                        }
-=======
-                       if (conn->asyncStatus == PGASYNC_IDLE ||
-                               conn->asyncStatus == PGASYNC_PIPELINE_IDLE)
-                               pqPipelineProcessQueue(conn);
->>>>>>> REL_16_9
                        break;
        }
 }
@@ -1541,10 +1519,7 @@ PQsendQueryInternal(PGconn *conn, const char *query, 
bool newQuery)
 
        /* OK, it's launched! */
        pqAppendCmdQueueEntry(conn, entry);
-<<<<<<< HEAD
-=======
 
->>>>>>> REL_16_9
        return 1;
 
 sendFailed:
@@ -2232,35 +2207,9 @@ PQgetResult(PGconn *conn)
                        break;
        }
 
-<<<<<<< HEAD
-       if (res)
-       {
-               int                     i;
-
-               for (i = 0; i < res->nEvents; i++)
-               {
-                       PGEventResultCreate evt;
-
-                       evt.conn = conn;
-                       evt.result = res;
-                       if (!res->events[i].proc(PGEVT_RESULTCREATE, &evt,
-                                                                        
res->events[i].passThrough))
-                       {
-                               appendPQExpBuffer(&conn->errorMessage,
-                                                                 
libpq_gettext("PGEventProc \"%s\" failed during PGEVT_RESULTCREATE event\n"),
-                                                                 
res->events[i].name);
-                               pqSetResultError(res, &conn->errorMessage);
-                               res->resultStatus = PGRES_FATAL_ERROR;
-                               break;
-                       }
-                       res->events[i].resultInitialized = true;
-               }
-       }
-=======
        /* Time to fire PGEVT_RESULTCREATE events, if there are any */
        if (res && res->nEvents > 0)
                (void) PQfireResultCreateEvents(conn, res);
->>>>>>> REL_16_9
 
        return res;
 }
@@ -3326,12 +3275,7 @@ PQsendFlushRequest(PGconn *conn)
        /* Don't try to send if we know there's no live connection. */
        if (conn->status != CONNECTION_OK)
        {
-<<<<<<< HEAD
-               appendPQExpBufferStr(&conn->errorMessage,
-                                                        libpq_gettext("no 
connection to the server\n"));
-=======
                libpq_append_conn_error(conn, "no connection to the server");
->>>>>>> REL_16_9
                return 0;
        }
 
@@ -3339,12 +3283,7 @@ PQsendFlushRequest(PGconn *conn)
        if (conn->asyncStatus != PGASYNC_IDLE &&
                conn->pipelineStatus == PQ_PIPELINE_OFF)
        {
-<<<<<<< HEAD
-               appendPQExpBufferStr(&conn->errorMessage,
-                                                        libpq_gettext("another 
command is already in progress\n"));
-=======
                libpq_append_conn_error(conn, "another command is already in 
progress");
->>>>>>> REL_16_9
                return 0;
        }
 
@@ -3354,17 +3293,6 @@ PQsendFlushRequest(PGconn *conn)
                return 0;
        }
 
-<<<<<<< HEAD
-=======
-       /*
-        * Give the data a push (in pipeline mode, only if we're past the size
-        * threshold).  In nonblock mode, don't complain if we're unable to send
-        * it all; PQgetResult() will do any additional flushing needed.
-        */
-       if (pqPipelineFlush(conn) < 0)
-               return 0;
-
->>>>>>> REL_16_9
        return 1;
 }
 
@@ -4043,10 +3971,6 @@ PQescapeStringInternal(PGconn *conn,
        const char *source = from;
        char       *target = to;
        size_t          remaining = strnlen(from, length);
-<<<<<<< HEAD
-=======
-       bool            already_complained = false;
->>>>>>> REL_16_9
 
        if (error)
                *error = 0;
@@ -4071,7 +3995,6 @@ PQescapeStringInternal(PGconn *conn,
                }
 
                /* Slow path for possible multibyte characters */
-<<<<<<< HEAD
                charlen = pg_encoding_mblen(encoding, source);
 
                if (remaining < charlen)
@@ -4086,85 +4009,23 @@ PQescapeStringInternal(PGconn *conn,
                         * This isn't *that* crucial when we can report an 
error to the
                         * caller, but if we can't, the caller will use this 
string
                         * unmodified and it needs to be safe for parsing.
-=======
-               charlen = pg_encoding_mblen_or_incomplete(encoding,
-                                                                               
                  source, remaining);
-
-               if (remaining < charlen ||
-                       pg_encoding_verifymbchar(encoding, source, charlen) == 
-1)
-               {
-                       /*
-                        * Multibyte character is invalid.  It's important to 
verify that
-                        * as invalid multibyte characters could e.g. be used 
to "skip"
-                        * over quote characters, e.g. when parsing
-                        * character-by-character.
-                        *
-                        * Report an error if possible, and replace the 
character's first
-                        * byte with an invalid sequence. The invalid sequence 
ensures
-                        * that the escaped string will trigger an error on the
-                        * server-side, even if we can't directly report an 
error here.
-                        *
-                        * This isn't *that* crucial when we can report an 
error to the
-                        * caller; but if we can't or the caller ignores it, 
the caller
-                        * will use this string unmodified and it needs to be 
safe for
-                        * parsing.
->>>>>>> REL_16_9
                         *
                         * We know there's enough space for the invalid 
sequence because
                         * the "to" buffer needs to be at least 2 * length + 1 
long, and
                         * at worst we're replacing a single input byte with 
two invalid
                         * bytes.
-<<<<<<< HEAD
                         */
                        if (error)
                                *error = 1;
                        if (conn)
                                appendPQExpBufferStr(&conn->errorMessage,
                                                                         
libpq_gettext("incomplete multibyte character\n"));
-=======
-                        *
-                        * It would be a bit faster to verify the whole string 
the first
-                        * time we encounter a set highbit, but this way we can 
replace
-                        * just the invalid data, which probably makes it 
easier for users
-                        * to find the invalidly encoded portion of a larger 
string.
-                        */
-                       if (error)
-                               *error = 1;
-                       if (conn && !already_complained)
-                       {
-                               if (remaining < charlen)
-                                       libpq_append_conn_error(conn, 
"incomplete multibyte character");
-                               else
-                                       libpq_append_conn_error(conn, "invalid 
multibyte character");
-                               /* Issue a complaint only once per string */
-                               already_complained = true;
-                       }
->>>>>>> REL_16_9
 
                        pg_encoding_set_invalid(encoding, target);
                        target += 2;
 
-<<<<<<< HEAD
                        /* there's no more input data, so we can stop */
                        break;
-=======
-                       /*
-                        * Handle the following bytes as if this byte didn't 
exist. That's
-                        * safer in case the subsequent bytes contain important 
characters
-                        * for the caller (e.g. '>' in html).
-                        */
-                       source++;
-                       remaining--;
-               }
-               else
-               {
-                       /* Copy the character */
-                       for (i = 0; i < charlen; i++)
-                       {
-                               *target++ = *source++;
-                               remaining--;
-                       }
->>>>>>> REL_16_9
                }
                else if (pg_encoding_verifymbchar(encoding, source, charlen) == 
-1)
                {
@@ -4260,11 +4121,7 @@ PQescapeInternal(PGconn *conn, const char *str, size_t 
len, bool as_ident)
        char       *rp;
        int                     num_quotes = 0; /* single or double, depending 
on as_ident */
        int                     num_backslashes = 0;
-<<<<<<< HEAD
        size_t          input_len = strlen(str);
-=======
-       size_t          input_len = strnlen(str, len);
->>>>>>> REL_16_9
        size_t          result_size;
        char            quote_char = as_ident ? '"' : '\'';
        bool            validated_mb = false;
@@ -4315,16 +4172,9 @@ PQescapeInternal(PGconn *conn, const char *str, size_t 
len, bool as_ident)
                        if (!validated_mb)
                        {
                                if 
(pg_encoding_verifymbstr(conn->client_encoding, s, remaining)
-<<<<<<< HEAD
                                        != strlen(s))
-                               {
-                                       
appendPQExpBufferStr(&conn->errorMessage,
-                                                                               
 libpq_gettext("invalid multibyte character\n"));
-=======
-                                       != remaining)
                                {
                                        libpq_append_conn_error(conn, "invalid 
multibyte character");
->>>>>>> REL_16_9
                                        return NULL;
                                }
                                validated_mb = true;
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index c16c7bd80ea..a6c46421c28 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -19,12 +19,8 @@
  * routines.
  *
  *
-<<<<<<< HEAD
  * Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
@@ -1329,7 +1325,6 @@ static void
 libpq_binddomain(void)
 {
        /*
-<<<<<<< HEAD
         * If multiple threads come through here at about the same time, it's 
okay
         * for more than one of them to call bindtextdomain().  But it's not 
okay
         * for any of them to return to caller before bindtextdomain() is
@@ -1337,16 +1332,6 @@ libpq_binddomain(void)
         * to be sure the compiler doesn't try to get cute.
         */
        static volatile bool already_bound = false;
-=======
-        * At least on Windows, there are gettext implementations that fail if
-        * multiple threads call bindtextdomain() concurrently.  Use a mutex and
-        * flag variable to ensure that we call it just once per process.  It is
-        * not known that similar bugs exist on non-Windows platforms, but we
-        * might as well do it the same way everywhere.
-        */
-       static volatile bool already_bound = false;
-       static pthread_mutex_t binddomain_mutex = PTHREAD_MUTEX_INITIALIZER;
->>>>>>> REL_16_9
 
        if (!already_bound)
        {
@@ -1357,34 +1342,12 @@ libpq_binddomain(void)
                int                     save_errno = errno;
 #endif
 
-<<<<<<< HEAD
                /* No relocatable lookup here because the binary could be 
anywhere */
                ldir = getenv("PGLOCALEDIR");
                if (!ldir)
                        ldir = LOCALEDIR;
                bindtextdomain(PG_TEXTDOMAIN("libpq"), ldir);
                already_bound = true;
-=======
-               (void) pthread_mutex_lock(&binddomain_mutex);
-
-               if (!already_bound)
-               {
-                       const char *ldir;
-
-                       /*
-                        * No relocatable lookup here because the calling 
executable could
-                        * be anywhere
-                        */
-                       ldir = getenv("PGLOCALEDIR");
-                       if (!ldir)
-                               ldir = LOCALEDIR;
-                       bindtextdomain(PG_TEXTDOMAIN("libpq"), ldir);
-                       already_bound = true;
-               }
-
-               (void) pthread_mutex_unlock(&binddomain_mutex);
-
->>>>>>> REL_16_9
 #ifdef WIN32
                SetLastError(save_errno);
 #else
diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c
index 192b064c32c..40620b47e94 100644
--- a/src/interfaces/libpq/fe-print.c
+++ b/src/interfaces/libpq/fe-print.c
@@ -304,39 +304,19 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt 
*po)
                        fputs("</table>\n", fout);
 
 exit:
-<<<<<<< HEAD
-               if (fieldMax)
-                       free(fieldMax);
-               if (fieldNotNum)
-                       free(fieldNotNum);
-               if (border)
-                       free(border);
-=======
                free(fieldMax);
                free(fieldNotNum);
                free(border);
->>>>>>> REL_16_9
                if (fields)
                {
                        /* if calloc succeeded, this shouldn't overflow size_t 
*/
                        size_t          numfields = ((size_t) nTups + 1) * 
(size_t) nFields;
 
                        while (numfields-- > 0)
-<<<<<<< HEAD
-                       {
-                               if (fields[numfields])
-                                       free(fields[numfields]);
-                       }
-                       free(fields);
-               }
-               if (fieldNames)
-                       free((void *) fieldNames);
-=======
                                free(fields[numfields]);
                        free(fields);
                }
                free(fieldNames);
->>>>>>> REL_16_9
                if (usePipe)
                {
 #ifdef WIN32
diff --git a/src/interfaces/libpq/fe-protocol3.c 
b/src/interfaces/libpq/fe-protocol3.c
index 8e8a8e69cae..79a17c6d5fe 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -271,7 +271,7 @@ pqParseInput3(PGconn *conn)
                                        else
                                        {
                                                /* Advance the command queue 
and set us idle */
-                                               pqCommandQueueAdvance(conn);
+                                               pqCommandQueueAdvance(conn, 
false, false);
                                                conn->asyncStatus = 
PGASYNC_IDLE;
                                        }
                                        break;
diff --git a/src/interfaces/libpq/fe-secure-openssl.c 
b/src/interfaces/libpq/fe-secure-openssl.c
index fd9b899aa26..8fcc5f98a05 100644
--- a/src/interfaces/libpq/fe-secure-openssl.c
+++ b/src/interfaces/libpq/fe-secure-openssl.c
@@ -1377,14 +1377,8 @@ initialize_SSL(PGconn *conn)
                /* Key file must be a regular file */
                if (!S_ISREG(buf.st_mode))
                {
-<<<<<<< HEAD
-                       appendPQExpBuffer(&conn->errorMessage,
-                                                         
libpq_gettext("private key file \"%s\" is not a regular file\n"),
-                                                         fnbuf);
-=======
                        libpq_append_conn_error(conn, "private key file \"%s\" 
is not a regular file",
                                                                        fnbuf);
->>>>>>> REL_16_9
                        return -1;
                }
 
@@ -1415,15 +1409,9 @@ initialize_SSL(PGconn *conn)
                        buf.st_mode & (S_IWGRP | S_IXGRP | S_IRWXO) :
                        buf.st_mode & (S_IRWXG | S_IRWXO))
                {
-<<<<<<< HEAD
-                       appendPQExpBuffer(&conn->errorMessage,
-                                                         
libpq_gettext("private key file \"%s\" has group or world access; file must 
have permissions u=rw (0600) or less if owned by the current user, or 
permissions u=rw,g=r (0640) or less if owned by root\n"),
-                                                         fnbuf);
-=======
                        libpq_append_conn_error(conn,
                                                                        
"private key file \"%s\" has group or world access; file must have permissions 
u=rw (0600) or less if owned by the current user, or permissions u=rw,g=r 
(0640) or less if owned by root",
                                                                        fnbuf);
->>>>>>> REL_16_9
                        return -1;
                }
 #endif
@@ -1937,19 +1925,11 @@ my_BIO_s_socket(void)
 
                my_bio_index = BIO_get_new_index();
                if (my_bio_index == -1)
-<<<<<<< HEAD
                        return NULL;
                my_bio_index |= (BIO_TYPE_DESCRIPTOR | BIO_TYPE_SOURCE_SINK);
                my_bio_methods = BIO_meth_new(my_bio_index, "libpq socket");
                if (!my_bio_methods)
                        return NULL;
-=======
-                       goto err;
-               my_bio_index |= (BIO_TYPE_DESCRIPTOR | BIO_TYPE_SOURCE_SINK);
-               res = BIO_meth_new(my_bio_index, "libpq socket");
-               if (!res)
-                       goto err;
->>>>>>> REL_16_9
 
                /*
                 * As of this writing, these functions never fail. But check 
anyway,
diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h
index ef4b875d7f4..00c9f3d47e7 100644
--- a/src/interfaces/libpq/libpq-int.h
+++ b/src/interfaces/libpq/libpq-int.h
@@ -781,7 +781,7 @@ extern PGresult *pqFunctionCall2(PGconn *conn, Oid fnid,
                                                                 int 
result_is_int,
                                                                 const 
PQArgBlock *args, int nargs);
 
-extern void pqCommandQueueAdvance(PGconn *conn);
+extern void pqCommandQueueAdvance(PGconn *conn, bool isReadyForQuery, bool 
gotSync);
 extern int     PQsendQueryContinue(PGconn *conn, const char *query);
 
 
diff --git a/src/interfaces/libpq/nls.mk b/src/interfaces/libpq/nls.mk
index f9456d05bdf..5959fa0c074 100644
--- a/src/interfaces/libpq/nls.mk
+++ b/src/interfaces/libpq/nls.mk
@@ -1,11 +1,5 @@
 # src/interfaces/libpq/nls.mk
 CATALOG_NAME     = libpq
-<<<<<<< HEAD
-AVAIL_LANGUAGES  = cs de el es fr ja ko ru sv uk zh_CN
-GETTEXT_FILES    = fe-auth.c fe-auth-scram.c fe-connect.c fe-exec.c 
fe-gssapi-common.c fe-lobj.c fe-misc.c fe-protocol3.c fe-secure.c 
fe-secure-common.c fe-secure-gssapi.c fe-secure-openssl.c win32.c
-GETTEXT_TRIGGERS = libpq_gettext pqInternalNotice:2
-GETTEXT_FLAGS    = libpq_gettext:1:pass-c-format pqInternalNotice:2:c-format
-=======
 GETTEXT_FILES    = fe-auth.c \
                    fe-auth-scram.c \
                    fe-connect.c \
@@ -31,4 +25,3 @@ GETTEXT_FLAGS    = libpq_append_conn_error:2:c-format \
                    libpq_ngettext:1:pass-c-format \
                    libpq_ngettext:2:pass-c-format \
                    pqInternalNotice:2:c-format
->>>>>>> REL_16_9
diff --git a/src/interfaces/libpq/pqexpbuffer.c 
b/src/interfaces/libpq/pqexpbuffer.c
index 1702941e93c..42326d9abcf 100644
--- a/src/interfaces/libpq/pqexpbuffer.c
+++ b/src/interfaces/libpq/pqexpbuffer.c
@@ -15,12 +15,8 @@
  * a usable vsnprintf(), then a copy of our own implementation of it will
  * be linked into libpq.
  *
-<<<<<<< HEAD
  * Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * src/interfaces/libpq/pqexpbuffer.c
@@ -52,11 +48,6 @@ static const char oom_buffer[1] = "";
 /* Need a char * for unconstify() compatibility */
 static const char *oom_buffer_ptr = oom_buffer;
 
-<<<<<<< HEAD
-
-=======
->>>>>>> REL_16_9
-
 /*
  * markPQExpBufferBroken
  *


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to