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 a1b660b490a Fix conflict for libpq
a1b660b490a is described below

commit a1b660b490a6c3edae8e89062e7f38062d64770c
Author: Jinbao Chen <[email protected]>
AuthorDate: Fri Jul 18 15:23:04 2025 +0800

    Fix conflict for libpq
---
 src/backend/libpq/auth.c             | 23 ++++---------------
 src/backend/libpq/be-fsstubs.c       | 41 ++++++---------------------------
 src/backend/libpq/be-secure-common.c | 44 +-----------------------------------
 src/backend/libpq/hba.c              |  5 ----
 src/backend/libpq/pqcomm.c           |  4 ----
 src/backend/libpq/pqsignal.c         |  3 ---
 src/common/percentrepl.c             | 14 ++++++++++++
 7 files changed, 26 insertions(+), 108 deletions(-)

diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index 06357332bc4..95008258866 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -352,9 +352,9 @@ auth_failed(Port *port, int status, const char *logdetail)
          }
        }
 
-<<<<<<< HEAD
-       cdetail = psprintf(_("Connection matched pg_hba.conf line %d: \"%s\""),
-                                          port->hba->linenumber, 
port->hba->rawline);
+       cdetail = psprintf(_("Connection matched file \"%s\" line %d: \"%s\""),
+                                          port->hba->sourcefile, 
port->hba->linenumber,
+                                          port->hba->rawline);
 
     /*
      * Avoid leak user infomations when failed to connect database using LDAP,
@@ -367,11 +367,6 @@ auth_failed(Port *port, int status, const char *logdetail)
         logdetail = NULL;
     }
 
-=======
-       cdetail = psprintf(_("Connection matched file \"%s\" line %d: \"%s\""),
-                                          port->hba->sourcefile, 
port->hba->linenumber,
-                                          port->hba->rawline);
->>>>>>> REL_16_9
        if (logdetail)
                logdetail = psprintf("%s\n%s", logdetail, cdetail);
        else
@@ -682,11 +677,7 @@ set_authn_id(Port *port, const char *id)
                ereport(FATAL,
                                (errmsg("authentication identifier set more 
than once"),
                                 errdetail_log("previous identifier: \"%s\"; 
new identifier: \"%s\"",
-<<<<<<< HEAD
-                                                          port->authn_id, 
id)));
-=======
                                                           
MyClientConnectionInfo.authn_id, id)));
->>>>>>> REL_16_9
        }
 
        MyClientConnectionInfo.authn_id = MemoryContextStrdup(TopMemoryContext, 
id);
@@ -2302,19 +2293,13 @@ auth_peer(hbaPort *port)
         */
        set_authn_id(port, pw->pw_name);
 
-<<<<<<< HEAD
        /*
         * GPDB: check for port->hba == NULL here, because auth_peer is used
         * without an HBA entry in the short-circuited QD->QE authentication,
         * from internal_client_authentication().
         */
        ret = check_usermap(port->hba ? port->hba->usermap : NULL,
-                                               port->user_name, 
port->authn_id, false);
-=======
-       ret = check_usermap(port->hba->usermap, port->user_name,
-                                               
MyClientConnectionInfo.authn_id, false);
-
->>>>>>> REL_16_9
+                                               port->user_name, 
MyClientConnectionInfo.authn_id, false);
        return ret;
 #else
        /* should have failed with ENOSYS above */
diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c
index a58402ac12c..caeccd1ddc1 100644
--- a/src/backend/libpq/be-fsstubs.c
+++ b/src/backend/libpq/be-fsstubs.c
@@ -43,10 +43,7 @@
 #include <unistd.h>
 
 #include "access/xact.h"
-<<<<<<< HEAD
-=======
 #include "catalog/pg_largeobject.h"
->>>>>>> REL_16_9
 #include "libpq/be-fsstubs.h"
 #include "libpq/libpq-fs.h"
 #include "miscadmin.h"
@@ -56,10 +53,7 @@
 #include "utils/builtins.h"
 #include "utils/memutils.h"
 #include "utils/snapmgr.h"
-<<<<<<< HEAD
-=======
 #include "varatt.h"
->>>>>>> REL_16_9
 
 /* define this to enable debug logging */
 /* #define FSDB 1 */
@@ -105,12 +99,9 @@ be_lo_open(PG_FUNCTION_ARGS)
        elog(DEBUG4, "lo_open(%u,%d)", lobjId, mode);
 #endif
 
-<<<<<<< HEAD
-=======
        if (mode & INV_WRITE)
                PreventCommandIfReadOnly("lo_open(INV_WRITE)");
 
->>>>>>> REL_16_9
        /*
         * Allocate a large object descriptor first.  This will also create
         * 'fscxt' if this is the first LO opened in this transaction.
@@ -271,7 +262,6 @@ be_lo_creat(PG_FUNCTION_ARGS)
 {
        Oid                     lobjId;
 
-<<<<<<< HEAD
        ereport(ERROR,
                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                 errmsg("large objects are not supported")));
@@ -281,9 +271,8 @@ be_lo_creat(PG_FUNCTION_ARGS)
         * ensure that AtEOXact_LargeObject knows there is state to clean up
         */
        lo_cleanup_needed = true;
-=======
+
        PreventCommandIfReadOnly("lo_creat()");
->>>>>>> REL_16_9
 
        lo_cleanup_needed = true;
        lobjId = inv_create(InvalidOid);
@@ -296,8 +285,7 @@ be_lo_create(PG_FUNCTION_ARGS)
 {
        Oid                     lobjId = PG_GETARG_OID(0);
 
-<<<<<<< HEAD
-       ereport(ERROR,
+       ereport(ERROR,
                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                 errmsg("large objects are not supported")));
 
@@ -306,9 +294,8 @@ be_lo_create(PG_FUNCTION_ARGS)
         * ensure that AtEOXact_LargeObject knows there is state to clean up
         */
        lo_cleanup_needed = true;
-=======
+
        PreventCommandIfReadOnly("lo_create()");
->>>>>>> REL_16_9
 
        lo_cleanup_needed = true;
        lobjId = inv_create(lobjId);
@@ -364,13 +351,11 @@ be_lo_unlink(PG_FUNCTION_ARGS)
 {
        Oid                     lobjId = PG_GETARG_OID(0);
 
-<<<<<<< HEAD
        ereport(ERROR,
                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                 errmsg("large objects are not supported")));
-=======
+
        PreventCommandIfReadOnly("lo_unlink()");
->>>>>>> REL_16_9
 
        /*
         * Must be owner of the large object.  It would be cleaner to check this
@@ -438,13 +423,11 @@ be_lowrite(PG_FUNCTION_ARGS)
        int                     bytestowrite;
        int                     totalwritten;
 
-<<<<<<< HEAD
        ereport(ERROR,
                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                 errmsg("large objects are not supported")));
-=======
+
        PreventCommandIfReadOnly("lowrite()");
->>>>>>> REL_16_9
 
        bytestowrite = VARSIZE_ANY_EXHDR(wbuf);
        totalwritten = lo_write(fd, VARDATA_ANY(wbuf), bytestowrite);
@@ -499,11 +482,9 @@ lo_import_internal(text *filename, Oid lobjOid)
        LargeObjectDesc *lobj;
        Oid                     oid;
 
-<<<<<<< HEAD
-=======
+
        PreventCommandIfReadOnly("lo_import()");
 
->>>>>>> REL_16_9
        /*
         * open the file to be read in
         */
@@ -652,13 +633,11 @@ be_lo_truncate(PG_FUNCTION_ARGS)
        int32           fd = PG_GETARG_INT32(0);
        int32           len = PG_GETARG_INT32(1);
 
-<<<<<<< HEAD
        ereport(ERROR,
                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                 errmsg("large objects are not supported")));
-=======
+
        PreventCommandIfReadOnly("lo_truncate()");
->>>>>>> REL_16_9
 
        lo_truncate_internal(fd, len);
        PG_RETURN_INT32(0);
@@ -913,11 +892,8 @@ be_lo_from_bytea(PG_FUNCTION_ARGS)
        LargeObjectDesc *loDesc;
        int                     written PG_USED_FOR_ASSERTS_ONLY;
 
-<<<<<<< HEAD
-=======
        PreventCommandIfReadOnly("lo_from_bytea()");
 
->>>>>>> REL_16_9
        lo_cleanup_needed = true;
        loOid = inv_create(loOid);
        loDesc = inv_open(loOid, INV_WRITE, CurrentMemoryContext);
@@ -940,11 +916,8 @@ be_lo_put(PG_FUNCTION_ARGS)
        LargeObjectDesc *loDesc;
        int                     written PG_USED_FOR_ASSERTS_ONLY;
 
-<<<<<<< HEAD
-=======
        PreventCommandIfReadOnly("lo_put()");
 
->>>>>>> REL_16_9
        lo_cleanup_needed = true;
        loDesc = inv_open(loOid, INV_WRITE, CurrentMemoryContext);
 
diff --git a/src/backend/libpq/be-secure-common.c 
b/src/backend/libpq/be-secure-common.c
index 0c3c4b668a8..3331d44eb3c 100644
--- a/src/backend/libpq/be-secure-common.c
+++ b/src/backend/libpq/be-secure-common.c
@@ -22,13 +22,10 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-<<<<<<< HEAD
-#include "postmaster/postmaster.h"
-=======
 #include "common/percentrepl.h"
->>>>>>> REL_16_9
 #include "common/string.h"
 #include "libpq/libpq.h"
+#include "postmaster/postmaster.h"
 #include "storage/fd.h"
 
 /*
@@ -55,46 +52,7 @@ run_ssl_passphrase_command(const char *prompt, bool 
is_server_start, char *buf,
 
        command = replace_percent_placeholders(ssl_passphrase_command, 
"ssl_passphrase_command", "p", prompt);
 
-<<<<<<< HEAD
-       for (p = ssl_passphrase_command; *p; p++)
-       {
-               if (p[0] == '%')
-               {
-                       switch (p[1])
-                       {
-                               case 'p':
-                                       appendStringInfoString(&command, 
prompt);
-                                       p++;
-                                       break;
-                               case 'R':
-                                       {
-                                               char fd_str[20];
-
-                                               if (terminal_fd == -1)
-                                                       ereport(ERROR,
-                                                                       
(errcode(ERRCODE_INTERNAL_ERROR),
-                                                                        
errmsg("ssl_passphrase_command referenced %%R, but -R not specified")));
-                                               p++;
-                                               snprintf(fd_str, 
sizeof(fd_str), "%d", terminal_fd);
-                                               
appendStringInfoString(&command, fd_str);
-                                               break;
-                                       }
-                               case '%':
-                                       appendStringInfoChar(&command, '%');
-                                       p++;
-                                       break;
-                               default:
-                                       appendStringInfoChar(&command, p[0]);
-                       }
-               }
-               else
-                       appendStringInfoChar(&command, p[0]);
-       }
-
-       fh = OpenPipeStream(command.data, "r");
-=======
        fh = OpenPipeStream(command, "r");
->>>>>>> REL_16_9
        if (fh == NULL)
        {
                ereport(loglevel,
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index b4bc267c8c9..222576804a5 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -2061,13 +2061,8 @@ parse_hba_line(TokenizedAuthLine *tok_line, int elevel)
        if (parsedline->auth_method == uaCert)
        {
                /*
-<<<<<<< HEAD
-                * For auth method cert, client certificate validation is 
mandatory, and it implies
-                * the level of verify-full.
-=======
                 * For auth method cert, client certificate validation is 
mandatory,
                 * and it implies the level of verify-full.
->>>>>>> REL_16_9
                 */
                parsedline->clientcert = clientCertFull;
        }
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index 3a91636476b..e622e27f1e0 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -1910,11 +1910,7 @@ pq_getkeepalivescount(Port *port)
 
        if (port->default_keepalives_count == 0)
        {
-<<<<<<< HEAD
-               socklen_t size = sizeof(port->default_keepalives_count);
-=======
                socklen_t       size = sizeof(port->default_keepalives_count);
->>>>>>> REL_16_9
 
                if (getsockopt(port->sock, IPPROTO_TCP, TCP_KEEPCNT,
                                           (char *) 
&port->default_keepalives_count,
diff --git a/src/backend/libpq/pqsignal.c b/src/backend/libpq/pqsignal.c
index 27533062c10..b815be6eeab 100644
--- a/src/backend/libpq/pqsignal.c
+++ b/src/backend/libpq/pqsignal.c
@@ -97,7 +97,6 @@ pqinitmask(void)
        sigdelset(&StartupBlockSig, SIGALRM);
 #endif
 }
-<<<<<<< HEAD
 
 /*
  * Set up a postmaster signal handler for signal "signo"
@@ -138,5 +137,3 @@ pqsignal_pm(int signo, pqsigfunc func)
                return SIG_ERR;
        return oact.sa_handler;
 }
-=======
->>>>>>> REL_16_9
diff --git a/src/common/percentrepl.c b/src/common/percentrepl.c
index fa4925c06fb..c8a93b6300a 100644
--- a/src/common/percentrepl.c
+++ b/src/common/percentrepl.c
@@ -22,6 +22,7 @@
 
 #include "common/percentrepl.h"
 #include "lib/stringinfo.h"
+#include "postmaster/postmaster.h"
 #include "utils/builtins.h"
 
 /*
@@ -94,6 +95,19 @@ replace_percent_placeholders(const char *instr, const char 
*param_name, const ch
                                sp++;
                                pg_ltoa(GpIdentity.segindex, contentid);
                        }
+                       else if (sp[1] == 'R')
+                       {
+                               char fd_str[20];
+
+                               if (terminal_fd == -1)
+                                       ereport(ERROR,
+                                                       
(errcode(ERRCODE_INTERNAL_ERROR),
+                                                                       
errmsg("ssl_passphrase_command referenced %%R, but -R not specified")));
+                               sp++;
+                               snprintf(fd_str, sizeof(fd_str), "%d", 
terminal_fd);
+                               appendStringInfoString(&result, fd_str);
+                               break;
+                       }
                        else
                        {
                                /* Look up placeholder character */


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

Reply via email to