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

reshke 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 04f3cf55451 Resolve rebase errors in `postgres_fdw`
04f3cf55451 is described below

commit 04f3cf55451322557544269374860a1df642abf5
Author: reshke <[email protected]>
AuthorDate: Sun Dec 21 18:56:09 2025 +0000

    Resolve rebase errors in `postgres_fdw`
---
 contrib/postgres_fdw/connection.c   | 45 +---------------------------
 contrib/postgres_fdw/deparse.c      |  7 -----
 contrib/postgres_fdw/option.c       |  9 ++----
 contrib/postgres_fdw/postgres_fdw.c | 60 +------------------------------------
 4 files changed, 5 insertions(+), 116 deletions(-)

diff --git a/contrib/postgres_fdw/connection.c 
b/contrib/postgres_fdw/connection.c
index a8a2d2e2e19..1349b7b47c9 100644
--- a/contrib/postgres_fdw/connection.c
+++ b/contrib/postgres_fdw/connection.c
@@ -17,12 +17,12 @@
 #include "catalog/pg_user_mapping.h"
 #include "commands/defrem.h"
 #include "funcapi.h"
+#include "postgres_fdw.h"
 #include "libpq/libpq-be.h"
 #include "libpq/libpq-be-fe-helpers.h"
 #include "mb/pg_wchar.h"
 #include "miscadmin.h"
 #include "pgstat.h"
-#include "postgres_fdw.h"
 #include "storage/fd.h"
 #include "storage/latch.h"
 #include "utils/builtins.h"
@@ -1068,28 +1068,7 @@ pgfdw_xact_callback(XactEvent event, void *arg)
                                                        continue;
                                        }
                                        else
-<<<<<<< HEAD
-                                       {
-                                               entry->have_prep_stmt = false;
-                                               entry->have_error = false;
-
-                                               /*
-                                                * If pendingAreq of the 
per-connection state is not
-                                                * NULL, it means that an 
asynchronous fetch begun by
-                                                * fetch_more_data_begin() was 
not done successfully
-                                                * and thus the per-connection 
state was not reset in
-                                                * fetch_more_data(); in that 
case reset the
-                                                * per-connection state here.
-                                                */
-                                               if (entry->state.pendingAreq)
-                                                       memset(&entry->state, 
0, sizeof(entry->state));
-                                       }
-
-                                       /* Disarm changing_xact_state if it all 
worked. */
-                                       entry->changing_xact_state = 
abort_cleanup_failure;
-=======
                                                pgfdw_abort_cleanup(entry, 
true);
->>>>>>> REL_16_9
                                        break;
                        }
                }
@@ -1195,32 +1174,10 @@ pgfdw_subxact_callback(SubXactEvent event, 
SubTransactionId mySubid,
                        /* Rollback all remote subtransactions during abort */
                        if (entry->parallel_abort)
                        {
-<<<<<<< HEAD
-                               /* Rollback all remote subtransactions during 
abort */
-                               snprintf(sql, sizeof(sql),
-                                                "ROLLBACK TO SAVEPOINT s%d; 
RELEASE SAVEPOINT s%d",
-                                                curlevel, curlevel);
-                               if (!pgfdw_exec_cleanup_query(entry->conn, sql, 
false))
-                                       abort_cleanup_failure = true;
-                               else
-                               {
-                                       /*
-                                        * If pendingAreq of the per-connection 
state is not NULL,
-                                        * it means that an asynchronous fetch 
begun by
-                                        * fetch_more_data_begin() was not done 
successfully and
-                                        * thus the per-connection state was 
not reset in
-                                        * fetch_more_data(); in that case 
reset the
-                                        * per-connection state here.
-                                        */
-                                       if (entry->state.pendingAreq)
-                                               memset(&entry->state, 0, 
sizeof(entry->state));
-                               }
-=======
                                if (pgfdw_abort_cleanup_begin(entry, false,
                                                                                
          &pending_entries,
                                                                                
          &cancel_requested))
                                        continue;
->>>>>>> REL_16_9
                        }
                        else
                                pgfdw_abort_cleanup(entry, false);
diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c
index 96fd38b6f25..fa96dd824f8 100644
--- a/contrib/postgres_fdw/deparse.c
+++ b/contrib/postgres_fdw/deparse.c
@@ -3772,10 +3772,6 @@ appendOrderByClause(List *pathkeys, bool has_final_sort,
 {
        ListCell   *lcell;
        int                     nestlevel;
-<<<<<<< HEAD
-       const char *delim = " ";
-=======
->>>>>>> REL_16_9
        StringInfo      buf = context->buf;
        bool            gotone = false;
 
@@ -3815,8 +3811,6 @@ appendOrderByClause(List *pathkeys, bool has_final_sort,
                em_expr = em->em_expr;
 
                /*
-<<<<<<< HEAD
-=======
                 * If the member is a Const expression then we needn't add it 
to the
                 * ORDER BY clause.  This can happen in UNION ALL queries where 
the
                 * union child targetlist has a Const.  Adding these would be
@@ -3837,7 +3831,6 @@ appendOrderByClause(List *pathkeys, bool has_final_sort,
                        appendStringInfoString(buf, ", ");
 
                /*
->>>>>>> REL_16_9
                 * Lookup the operator corresponding to the strategy in the 
opclass.
                 * The datatype used by the opfamily is not necessarily the 
same as
                 * the expression type (for array types for example).
diff --git a/contrib/postgres_fdw/option.c b/contrib/postgres_fdw/option.c
index ed85009d6fd..55103e545b0 100644
--- a/contrib/postgres_fdw/option.c
+++ b/contrib/postgres_fdw/option.c
@@ -287,18 +287,15 @@ InitPgFdwOptions(void)
                 */
                {"sslcert", UserMappingRelationId, true},
                {"sslkey", UserMappingRelationId, true},
-
-<<<<<<< HEAD
-               /* num_segments is available on server only */
-               {"num_segments", ForeignServerRelationId, false},
-=======
                /*
                 * gssdelegation is also a libpq option but should be allowed 
in a
                 * user mapping context too
                 */
                {"gssdelegation", UserMappingRelationId, true},
 
->>>>>>> REL_16_9
+               /* num_segments is available on server only */
+               {"num_segments", ForeignServerRelationId, false},
+
                {NULL, InvalidOid, false}
        };
 
diff --git a/contrib/postgres_fdw/postgres_fdw.c 
b/contrib/postgres_fdw/postgres_fdw.c
index a80948fb04f..7b08f5732fe 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -1649,11 +1649,7 @@ postgresReScanForeignScan(ForeignScanState *node)
                return;
 
        /*
-<<<<<<< HEAD
-        * If the node is async-capable, and an asynchronous fetch for it has 
been
-=======
         * If the node is async-capable, and an asynchronous fetch for it has
->>>>>>> REL_16_9
         * begun, the asynchronous fetch might not have yet completed.  Check if
         * the node is async-capable, and an asynchronous fetch for it is still 
in
         * progress; if so, complete the asynchronous fetch before restarting 
the
@@ -2057,14 +2053,9 @@ postgresGetForeignModifyBatchSize(ResultRelInfo 
*resultRelInfo)
                batch_size = 
get_batch_size_option(resultRelInfo->ri_RelationDesc);
 
        /*
-<<<<<<< HEAD
-        * Disable batching when we have to use RETURNING or there are any
-        * BEFORE/AFTER ROW INSERT triggers on the foreign table.
-=======
         * Disable batching when we have to use RETURNING, there are any
         * BEFORE/AFTER ROW INSERT triggers on the foreign table, or there are 
any
         * WITH CHECK OPTION constraints from parent views.
->>>>>>> REL_16_9
         *
         * When there are any BEFORE ROW INSERT triggers on the table, we can't
         * support it, because such triggers might query the table we're 
inserting
@@ -2076,8 +2067,6 @@ postgresGetForeignModifyBatchSize(ResultRelInfo 
*resultRelInfo)
                (resultRelInfo->ri_TrigDesc &&
                 (resultRelInfo->ri_TrigDesc->trig_insert_before_row ||
                  resultRelInfo->ri_TrigDesc->trig_insert_after_row)))
-<<<<<<< HEAD
-=======
                return 1;
 
        /*
@@ -2087,7 +2076,6 @@ postgresGetForeignModifyBatchSize(ResultRelInfo 
*resultRelInfo)
         * case fmstate must be non-NULL.
         */
        if (fmstate && list_length(fmstate->target_attrs) == 0)
->>>>>>> REL_16_9
                return 1;
 
        /*
@@ -5561,29 +5549,16 @@ postgresImportForeignSchema(ImportForeignSchemaStmt 
*stmt, Oid serverOid)
                                                           "SELECT relname, "
                                                           "  attname, "
                                                           "  
format_type(atttypid, atttypmod), "
-<<<<<<< HEAD
-                                                          "  attnotnull, ");
-=======
                                                           "  attnotnull, "
                                                           "  
pg_get_expr(adbin, adrelid), ");
->>>>>>> REL_16_9
 
                /* Generated columns are supported since Postgres 12 */
                if (PQserverVersion(conn) >= 120000)
                        appendStringInfoString(&buf,
-<<<<<<< HEAD
-                                                                  "  
attgenerated, "
-                                                                  "  
pg_get_expr(adbin, adrelid), ");
-               else
-                       appendStringInfoString(&buf,
-                                                                  "  NULL, "
-                                                                  "  
pg_get_expr(adbin, adrelid), ");
-=======
                                                                   "  
attgenerated, ");
                else
                        appendStringInfoString(&buf,
                                                                   "  NULL, ");
->>>>>>> REL_16_9
 
                if (import_collate)
                        appendStringInfoString(&buf,
@@ -5609,20 +5584,6 @@ postgresImportForeignSchema(ImportForeignSchemaStmt 
*stmt, Oid serverOid)
                                                                   "    
coll.oid = attcollation "
                                                                   "  LEFT JOIN 
pg_namespace collnsp ON "
                                                                   "    
collnsp.oid = collnamespace ");
-<<<<<<< HEAD
-               else
-                       appendStringInfoString(&buf,
-                                                                  "  NULL, 
NULL "
-                                                                  "FROM 
pg_class c "
-                                                                  "  JOIN 
pg_namespace n ON "
-                                                                  "    
relnamespace = n.oid "
-                                                                  "  LEFT JOIN 
pg_attribute a ON "
-                                                                  "    
attrelid = c.oid AND attnum > 0 "
-                                                                  "      AND 
NOT attisdropped "
-                                                                  "  LEFT JOIN 
pg_attrdef ad ON "
-                                                                  "    adrelid 
= c.oid AND adnum = attnum ");
-=======
->>>>>>> REL_16_9
 
                appendStringInfoString(&buf,
                                                           "WHERE c.relkind IN 
("
@@ -5703,13 +5664,9 @@ postgresImportForeignSchema(ImportForeignSchemaStmt 
*stmt, Oid serverOid)
                                attname = PQgetvalue(res, i, 1);
                                typename = PQgetvalue(res, i, 2);
                                attnotnull = PQgetvalue(res, i, 3);
-                               attgenerated = PQgetisnull(res, i, 4) ? (char 
*) NULL :
+                               attdefault = PQgetisnull(res, i, 4) ? (char *) 
NULL :
                                        PQgetvalue(res, i, 4);
-<<<<<<< HEAD
-                               attdefault = PQgetisnull(res, i, 5) ? (char *) 
NULL :
-=======
                                attgenerated = PQgetisnull(res, i, 5) ? (char 
*) NULL :
->>>>>>> REL_16_9
                                        PQgetvalue(res, i, 5);
                                collname = PQgetisnull(res, i, 6) ? (char *) 
NULL :
                                        PQgetvalue(res, i, 6);
@@ -7326,16 +7283,6 @@ postgresForeignAsyncConfigureWait(AsyncRequest *areq)
        {
                /*
                 * This is the case when the in-process request was made by 
another
-<<<<<<< HEAD
-                * Append.  Note that it might be useless to process the 
request,
-                * because the query might not need tuples from that Append 
anymore.
-                * If there are any child subplans of the same parent that are 
ready
-                * for new requests, skip the given request.  Likewise, if 
there are
-                * any configured events other than the postmaster death event, 
skip
-                * it.  Otherwise, process the in-process request, then begin a 
fetch
-                * to configure the event below, because we might otherwise end 
up
-                * with no configured events other than the postmaster death 
event.
-=======
                 * Append.  Note that it might be useless to process the 
request made
                 * by that Append, because the query might not need tuples from 
that
                 * Append anymore; so we avoid processing it to begin a fetch 
for the
@@ -7346,7 +7293,6 @@ postgresForeignAsyncConfigureWait(AsyncRequest *areq)
                 * in-process request, then begin a fetch to configure the event
                 * below, because we might otherwise end up with no configured 
events
                 * other than the postmaster death event.
->>>>>>> REL_16_9
                 */
                if (!bms_is_empty(requestor->as_needrequest))
                        return;
@@ -7516,11 +7462,7 @@ void
 process_pending_request(AsyncRequest *areq)
 {
        ForeignScanState *node = (ForeignScanState *) areq->requestee;
-<<<<<<< HEAD
-       PgFdwScanState *fsstate PG_USED_FOR_ASSERTS_ONLY = (PgFdwScanState *) 
node->fdw_state;
-=======
        PgFdwScanState *fsstate = (PgFdwScanState *) node->fdw_state;
->>>>>>> REL_16_9
 
        /* The request would have been pending for a callback */
        Assert(areq->callback_pending);


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

Reply via email to