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

djwang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry-pxf.git


The following commit(s) were added to refs/heads/main by this push:
     new f9dcc03d feat: cleanup the PG_VERSION_NUM logic in source files (#41)
f9dcc03d is described below

commit f9dcc03debf6c31dac9560dc4d8541854ef6e3d7
Author: liuxiaoyu <[email protected]>
AuthorDate: Wed Jan 28 16:52:23 2026 +0800

    feat: cleanup the PG_VERSION_NUM logic in source files (#41)
---
 external-table/src/gpdbwritableformatter.c   |  69 ++--
 external-table/src/pxfdelimited_formatter.c  |   6 -
 external-table/src/pxfheaders.c              | 449 +--------------------------
 external-table/src/pxfheaders.h              |   4 -
 external-table/src/pxfprotocol.c             |   4 -
 external-table/src/pxfuriparser.c            |   6 -
 external-table/src/pxfuriparser.h            |   2 -
 external-table/src/pxfutils.c                |   8 -
 external-table/test/libchurl_test.c          |  13 -
 external-table/test/mock/pxffragment_mock.c  |  20 --
 external-table/test/mock/pxfuriparser_mock.c |   9 -
 external-table/test/pxfbridge_test.c         |   2 -
 external-table/test/pxffilters_test.c        |  63 ----
 external-table/test/pxffragment_test.c       |  35 ---
 external-table/test/pxfheaders_test.c        |  40 +--
 external-table/test/pxfprotocol_test.c       |   2 -
 external-table/test/pxfuriparser_test.c      |   2 -
 external-table/test/pxfutils_test.c          |   2 -
 18 files changed, 36 insertions(+), 700 deletions(-)

diff --git a/external-table/src/gpdbwritableformatter.c 
b/external-table/src/gpdbwritableformatter.c
index d18b7e44..986da281 100644
--- a/external-table/src/gpdbwritableformatter.c
+++ b/external-table/src/gpdbwritableformatter.c
@@ -46,9 +46,7 @@
 #include "utils/lsyscache.h"
 
 #include <unistd.h>
-#if PG_VERSION_NUM >= 120000
 #include "access/external.h"
-#endif
 
 PG_FUNCTION_INFO_V1(gpdbwritableformatter_export);
 PG_FUNCTION_INFO_V1(gpdbwritableformatter_import);
@@ -106,7 +104,6 @@ typedef struct
 /* Bit flag */
 #define GPDBWRITABLE_BITFLAG_ISNULL 1  /* Column is null */
 
-#if PG_VERSION_NUM >= 90400
 /*
  * appendStringInfoFill
  *
@@ -128,7 +125,6 @@ appendStringInfoFill(StringInfo str, int occurrences, char 
ch)
        str->len += occurrences;
        str->data[str->len] = '\0';
 }
-#endif
 
 #ifndef unlikely
 #if __GNUC__ > 3
@@ -148,11 +144,6 @@ appendStringInfoFill(StringInfo str, int occurrences, char 
ch)
                } \
        } while (0)
 
-#if PG_VERSION_NUM < 90400
-// Copied from tupdesc.h (6.x), since this is not present in GPDB 5
-/* Accessor for the i'th attribute of tupdesc. */
-#define TupleDescAttr(tupdesc, i) ((tupdesc)->attrs[(i)])
-#endif
 
 /*
  * Write a int4 to the buffer
@@ -512,27 +503,20 @@ gpdbwritableformatter_export(PG_FUNCTION_ARGS)
         */
        if (myData == NULL)
        {
-        // In GP7 FORMATTER_GET_EXTENCODING(fcinfo) gets the database encoding 
which may not match the table encoding
-        // and thus results in exception here. So getting the table encoding 
from the ExtTableEntry
-#if PG_VERSION_NUM < 120000
-        if (FORMATTER_GET_EXTENCODING(fcinfo) != PG_UTF8)
-        {
-                 ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
-                            errmsg(FORMATTER_ENCODING_ERR_MSG, "export")));
-        }
-#else
+        // FORMATTER_GET_EXTENCODING(fcinfo) may return database encoding; use 
table encoding instead.
         Relation rel = FORMATTER_GET_RELATION(fcinfo);
-        if(rel == NULL) {
+        if (rel == NULL)
+        {
             ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
                             errmsg(FORMATTER_ENCODING_ERR_MSG, "export")));
         }
 
         ExtTableEntry *exttbl = GetExtTableEntry(rel->rd_id);
-        if (exttbl->encoding != PG_UTF8) {
+        if (exttbl->encoding != PG_UTF8)
+        {
             ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
-                    errmsg(FORMATTER_ENCODING_ERR_MSG, "export")));
+                            errmsg(FORMATTER_ENCODING_ERR_MSG, "export")));
         }
-#endif
 
                myData = palloc(sizeof(format_t));
                myData->values = palloc(sizeof(Datum) * ncolumns);
@@ -785,27 +769,20 @@ gpdbwritableformatter_import(PG_FUNCTION_ARGS)
         */
        if (myData == NULL)
        {
-        // In GP7 FORMATTER_GET_EXTENCODING(fcinfo) gets the database encoding 
which may not match the table encoding
-        // and thus results in exception here. So getting the table encoding 
from the ExtTableEntry
-#if PG_VERSION_NUM < 120000
-            if (FORMATTER_GET_EXTENCODING(fcinfo) != PG_UTF8)
-            {
-                     ereport(ERROR, 
(errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
-                                errmsg(FORMATTER_ENCODING_ERR_MSG, "import")));
-            }
-#else
-            Relation rel = FORMATTER_GET_RELATION(fcinfo);
-            if(rel == NULL) {
-                ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
-                                    errmsg(FORMATTER_ENCODING_ERR_MSG, 
"import")));
-            }
-
-            ExtTableEntry *exttbl = GetExtTableEntry(rel->rd_id);
-            if (exttbl->encoding != PG_UTF8) {
-                ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
-                        errmsg(FORMATTER_ENCODING_ERR_MSG, "import")));
-            }
-#endif
+        // FORMATTER_GET_EXTENCODING(fcinfo) may return database encoding; use 
table encoding instead.
+        Relation rel = FORMATTER_GET_RELATION(fcinfo);
+        if (rel == NULL)
+        {
+            ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
+                            errmsg(FORMATTER_ENCODING_ERR_MSG, "import")));
+        }
+
+        ExtTableEntry *exttbl = GetExtTableEntry(rel->rd_id);
+        if (exttbl->encoding != PG_UTF8)
+        {
+            ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
+                            errmsg(FORMATTER_ENCODING_ERR_MSG, "import")));
+        }
 
                myData = palloc(sizeof(format_t));
                myData->values = palloc(sizeof(Datum) * ncolumns);
@@ -1045,11 +1022,7 @@ static inline Form_pg_attribute
 getAttributeFromTupleDesc(TupleDesc tupdesc, int index)
 {
     Form_pg_attribute attr;
-    #if PG_VERSION_NUM >= 120000
-         attr = &tupdesc->attrs[index];
-    #else
-         attr = tupdesc->attrs[index];
-    #endif
+    attr = &tupdesc->attrs[index];
 
     return attr;
 
diff --git a/external-table/src/pxfdelimited_formatter.c 
b/external-table/src/pxfdelimited_formatter.c
index 6617c547..58faa9ee 100644
--- a/external-table/src/pxfdelimited_formatter.c
+++ b/external-table/src/pxfdelimited_formatter.c
@@ -8,12 +8,6 @@ Datum pxfdelimited_import(PG_FUNCTION_ARGS);
 
 #define is_even(cnt) (cnt % 2 == 0)
 
-#if PG_VERSION_NUM < 90400
-// Copied from tupdesc.h (6.x), since this is not present in GPDB 5
-/* Accessor for the i'th attribute of tupdesc. */
-#define TupleDescAttr(tupdesc, i) ((tupdesc)->attrs[(i)])
-#endif
-
 /**
  * Helper function to count the number of occurrences of a given character 
(from right to left) given a pointer to the current location in the string
  * and a pointer to the beginning of the string
diff --git a/external-table/src/pxfheaders.c b/external-table/src/pxfheaders.c
index 203c6a79..39671cb1 100644
--- a/external-table/src/pxfheaders.c
+++ b/external-table/src/pxfheaders.c
@@ -20,14 +20,9 @@
 #include "pxffilters.h"
 #include "pxfheaders.h"
 #include "commands/defrem.h"
-#if PG_VERSION_NUM >= 120000
 #include "access/external.h"
 #include "extension/gp_exttable_fdw/extaccess.h"
 #include "executor/execExpr.h"
-#else
-#include "access/fileam.h"
-#include "catalog/pg_exttable.h"
-#endif
 #include "utils/timestamp.h"
 #include "nodes/makefuncs.h"
 #include "cdb/cdbvars.h"
@@ -40,11 +35,7 @@ static char *get_format_name(ExtTableEntry *exttbl);
 static char *getFormatterString(ExtTableEntry *exttbl);
 static bool isFormatterPxfDelimited(ExtTableEntry *exttbl);
 static bool isFormatterPxfWritable(ExtTableEntry *exttbl);
-#if PG_VERSION_NUM >= 120000
 static void add_projection_desc_httpheader_pg12(CHURL_HEADERS headers, 
ProjectionInfo *projInfo, List *qualsAttributes, Relation rel);
-#else
-static void add_projection_desc_httpheader_pg94(CHURL_HEADERS headers, 
ProjectionInfo *projInfo, List *qualsAttributes, Relation rel);
-#endif
 
 static bool add_attnums_from_targetList(Node *node, List *attnums);
 static void add_projection_index_header(CHURL_HEADERS pVoid, StringInfoData 
data, int attno, char number[32]);
@@ -55,21 +46,6 @@ static bool needToIterateTargetList(List *targetList, int 
*varNumbers);
 static Node *getTargetListEntryExpression(ListCell *lc1);
 static int  getNumSimpleVars(ProjectionInfo *projInfo);
 
-#if PG_VERSION_NUM < 90400
-/*
- * this function is copied from Greenplum 6 (6X_STABLE branch) code
- * it is defined here for compilation with Greenplum 5 only
- * for compilation with Greenplum 6 it is defined in included fileam.h
- * in Greenplum 7 we do not need to define and call it as all options (copy or 
custom)
- * are added to ExtTableEntry.options list by 
external.c::GetExtFromForeignTableOptions()
- */
-static List *parseCopyFormatString(Relation rel, char *fmtstr, char fmttype);
-
-// Copied this Macro from tupdesc.h (6.x), since this is not present in GPDB 5
-/* Accessor for the i'th attribute of tupdesc. */
-#define TupleDescAttr(tupdesc, i) ((tupdesc)->attrs[(i)])
-#endif
-
 /*
  * Add key/value pairs to connection header.
  * These values are the context of the query and used
@@ -119,11 +95,7 @@ build_http_headers(PxfInputData *input)
     /* Parse fmtOptString here */
     if (fmttype_is_text(exttbl->fmtcode) || fmttype_is_csv(exttbl->fmtcode))
     {
-#if PG_VERSION_NUM >= 120000
       copyFmtOpts = exttbl->options;
-#else
-      copyFmtOpts = parseCopyFormatString(rel, exttbl->fmtopts, 
exttbl->fmtcode);
-#endif
     }
 
                /* pass external table's encoding to copy's options */
@@ -161,11 +133,7 @@ build_http_headers(PxfInputData *input)
                if (qualsAreSupported &&
                        (qualsAttributes != NIL || list_length(input->quals) == 
0))
                {
-                       #if PG_VERSION_NUM >= 120000
-                               add_projection_desc_httpheader_pg12(headers, 
proj_info, qualsAttributes, rel);
-                       #else
-                               add_projection_desc_httpheader_pg94(headers, 
proj_info, qualsAttributes, rel);
-                       #endif
+                       add_projection_desc_httpheader_pg12(headers, proj_info, 
qualsAttributes, rel);
                }
                else
                {
@@ -281,11 +249,7 @@ add_tuple_desc_httpheader(CHURL_HEADERS headers, Relation 
rel)
        /* Iterate attributes */
        for (i = 0, attrIx = 0; i < tuple->natts; ++i)
        {
-               #if PG_VERSION_NUM >= 120000
-                       FormData_pg_attribute *attribute = &tuple->attrs[i];
-               #else
-                       FormData_pg_attribute *attribute = tuple->attrs[i];
-               #endif
+               FormData_pg_attribute *attribute = &tuple->attrs[i];
 
                /* Ignore dropped attributes. */
                if (attribute->attisdropped)
@@ -410,11 +374,7 @@ add_tuple_desc_httpheader(CHURL_HEADERS headers, Relation 
rel)
  */
 static inline int*
 getVarNumbers(ProjectionInfo *projInfo) {
-#if PG_VERSION_NUM >= 120000
        return NULL; // does not exist in projInfo in GP7
-#else
-       return projInfo->pi_varNumbers;
-#endif
 }
 
 /*
@@ -423,11 +383,7 @@ getVarNumbers(ProjectionInfo *projInfo) {
 static inline List*
 getTargetList(ProjectionInfo *projInfo)
 {
-#if PG_VERSION_NUM >= 120000
        return (List *) projInfo->pi_state.expr;
-#else
-       return projInfo->pi_targetlist;
-#endif
 }
 
 /*
@@ -436,20 +392,12 @@ getTargetList(ProjectionInfo *projInfo)
 static inline bool
 needToIterateTargetList(List *targetList, int *varNumbers)
 {
-#if PG_VERSION_NUM >= 90400
        /*
         * In GP6 non-simple Vars are added to the targetlist of ProjectionInfo 
while
         * simple Vars are pre-computed and their attnos are placed into 
varNumbers array
         * In GP7 everything is in targetList
         */
        return (targetList != NULL);
-#else
-       /*
-        * In GP5 if targetList contains ONLY simple Vars their attrnos will be 
populated into varNumbers array
-        * otherwise the varNumbers array will be NULL, and we will need to 
iterate over the targetList
-        */
-       return (varNumbers == NULL);
-#endif
 }
 
 /*
@@ -458,13 +406,8 @@ needToIterateTargetList(List *targetList, int *varNumbers)
 static inline
 Node *getTargetListEntryExpression(ListCell *lc1)
 {
-#if PG_VERSION_NUM >= 120000
        ExprState *gstate = (ExprState *) lfirst(lc1);
        return (Node *) gstate;
-#else
-       GenericExprState *gstate = (GenericExprState *) lfirst(lc1);
-       return (Node *) gstate->arg->expr;
-#endif
 };
 
 /*
@@ -473,21 +416,8 @@ Node *getTargetListEntryExpression(ListCell *lc1)
 static inline
 int getNumSimpleVars(ProjectionInfo *projInfo)
 {
-       int numSimpleVars = 0;
-#if PG_VERSION_NUM < 90400
-       // in GP5 if varNumbers is not NULL, it means the attrnos have been 
pre-computed in varNumbers
-       // and targetList consists only of simpleVars, so we can use its length
-       if (projInfo->pi_varNumbers)
-       {
-               numSimpleVars = list_length(projInfo->pi_targetlist);
-       }
-#elif PG_VERSION_NUM < 120000
-       // in GP6 we can get this value from projInfo
-       numSimpleVars = projInfo->pi_numSimpleVars;
-#else
        // in GP7 there is no precomputation, the numSimpleVars stays at 0
-#endif
-       return numSimpleVars;
+       return 0;
 };
 
 /*
@@ -505,136 +435,6 @@ int getNumSimpleVars(ProjectionInfo *projInfo)
  * col2 was dropped, the indices for col3 and col4 get shifted by -1.
  */
 
-#if PG_VERSION_NUM < 120000
-static void
-add_projection_desc_httpheader_pg94(CHURL_HEADERS headers,
-                 ProjectionInfo *projInfo,
-                 List *qualsAttributes,
-                 Relation rel)
-{
-       int                        i;
-       int                        dropped_count;
-       int                        number;
-#if PG_VERSION_NUM < 90400
-       int                        numSimpleVars;
-#endif
-       char                    long_number[sizeof(int32) * 8];
-       int                             *varNumbers = projInfo->pi_varNumbers;
-       Bitmapset               *attrs_used;
-       StringInfoData  formatter;
-       TupleDesc               tupdesc;
-
-       initStringInfo(&formatter);
-       attrs_used = NULL;
-       number = 0;
-
-#if PG_VERSION_NUM >= 90400
-       /*
-        * Non-simpleVars are added to the targetlist
-        * we use expression_tree_walker to access attrno information
-        * we do it through a helper function add_attnums_from_targetList
-        */
-       if (projInfo->pi_targetlist)
-       {
-#else
-       numSimpleVars = 0;
-
-       if (!varNumbers)
-       {
-               /*
-                * When there are not just simple Vars we need to
-                * walk the tree to get attnums
-                */
-#endif
-               List     *l = lappend_int(NIL, 0);
-               ListCell *lc1;
-
-               foreach(lc1, projInfo->pi_targetlist)
-               {
-                       GenericExprState *gstate = (GenericExprState *) 
lfirst(lc1);
-                       add_attnums_from_targetList((Node *) gstate->arg->expr, 
l);
-               }
-
-               foreach(lc1, l)
-               {
-                       int attno = lfirst_int(lc1);
-                       if (attno > InvalidAttrNumber)
-                       {
-                               attrs_used =
-                                       bms_add_member(attrs_used,
-                                                                       attno - 
FirstLowInvalidHeapAttributeNumber);
-                       }
-               }
-
-               list_free(l);
-       }
-#if PG_VERSION_NUM < 90400
-       else
-       {
-               numSimpleVars = list_length(projInfo->pi_targetlist);
-       }
-#endif
-
-
-#if PG_VERSION_NUM >= 90400
-       for (i = 0; i < projInfo->pi_numSimpleVars; i++)
-#else
-       for (i = 0; varNumbers && i < numSimpleVars; i++)
-#endif
-       {
-               attrs_used =
-                       bms_add_member(attrs_used,
-                                                varNumbers[i] - 
FirstLowInvalidHeapAttributeNumber);
-       }
-
-       ListCell *attribute = NULL;
-
-       /*
-        * AttrNumbers coming from quals
-        */
-       foreach(attribute, qualsAttributes)
-       {
-               AttrNumber attrNumber = (AttrNumber) lfirst_int(attribute);
-               attrs_used =
-                       bms_add_member(attrs_used,
-                                                attrNumber + 1 - 
FirstLowInvalidHeapAttributeNumber);
-       }
-
-       tupdesc = RelationGetDescr(rel);
-       dropped_count = 0;
-
-       for (i = 1; i <= tupdesc->natts; i++)
-       {
-               /* Ignore dropped attributes. */
-               if (tupdesc->attrs[i - 1]->attisdropped)
-               {
-                       /* keep a counter of the number of dropped attributes */
-                       dropped_count++;
-                       continue;
-               }
-
-               if (bms_is_member(i - FirstLowInvalidHeapAttributeNumber, 
attrs_used))
-               {
-                       /* Shift the column index by the running dropped_count 
*/
-                       add_projection_index_header(headers, formatter,
-                                                                               
i - 1 - dropped_count, long_number);
-                       number++;
-               }
-       }
-
-       if (number != 0)
-       {
-               /* Convert the number of projection columns to a string */
-               pg_ltoa(number, long_number);
-               churl_headers_append(headers, "X-GP-ATTRS-PROJ", long_number);
-       }
-
-       list_free(qualsAttributes);
-       pfree(formatter.data);
-       bms_free(attrs_used);
-}
-#endif
-
 /*
  * Report projection description to the remote component, the indices of
  * dropped columns do not get reported, as if they never existed, and
@@ -650,7 +450,6 @@ add_projection_desc_httpheader_pg94(CHURL_HEADERS headers,
  * col2 was dropped, the indices for col3 and col4 get shifted by -1.
  */
 
-#if PG_VERSION_NUM >= 120000
 static void
 set_var_number(int **varNumbers, int *varNumberSize, int value, int offset)
 {
@@ -679,9 +478,8 @@ add_projection_desc_httpheader_pg12(CHURL_HEADERS headers,
   int        number;
   int        numTargetList;
   char      long_number[sizeof(int32) * 8];
-    // In versions < 120000, projInfo->pi_varNumbers contains atttribute 
numbers of SimpleVars
-    // Since,this pi_varNumbers doesn't exist in PG12 and above, we can add 
the attribute numbers by
-    // iterating on the Simple vars.
+    // projInfo->pi_varNumbers doesn't exist in PG14+, so collect attribute 
numbers
+    // by iterating on the simple vars.
   
   int       varNumbersSize = 0;
   int       *varNumbers = NULL;
@@ -802,7 +600,6 @@ add_projection_desc_httpheader_pg12(CHURL_HEADERS headers,
   pfree(formatter.data);
   bms_free(attrs_used);
 }
-#endif
 
 
 /*
@@ -886,7 +683,6 @@ getFormatterString(ExtTableEntry *exttbl)
 {
        char *formatterNameSearchString = NULL;
 
-#if PG_VERSION_NUM >= 120000
        // for GP7 the custom formatter name is among all other options of the 
corresponding foreign table
        ListCell   *option;
        foreach (option, exttbl->options) {
@@ -896,11 +692,6 @@ getFormatterString(ExtTableEntry *exttbl)
                        break;
                }
        }
-#else
-       // for GP5 and GP6, we only have a serialized string of formatter 
options,
-       // parsing it requires porting a lot of code from GP6 so return the 
entire serialized string
-       formatterNameSearchString = exttbl->fmtopts;
-#endif
 
        return formatterNameSearchString;
 }
@@ -966,11 +757,7 @@ add_attnums_from_targetList(Node *node, List *attnums)
         */
        if (IsA(node, Aggref))
                return false;
-#if PG_VERSION_NUM >= 90400
        if (IsA(node, WindowFunc))
-#else
-       if (IsA(node, WindowRef))
-#endif
                return false;
        return expression_tree_walker(node,
                                                                  
add_attnums_from_targetList,
@@ -985,226 +772,8 @@ add_attnums_from_targetList(Node *node, List *attnums)
  */
 static List *
 appendCopyEncodingOptionToList(List *copyFmtOpts, int encoding) {
-       return lappend(copyFmtOpts, makeDefElem("encoding", (Node *) 
makeString((char *) pg_encoding_to_char(encoding))
-#if PG_VERSION_NUM >= 120000 // GP7 requires an extra parameter for 
makeDefElem()
-                                       , -1
-#endif
-                                       ));
-}
-
-#if PG_VERSION_NUM < 90400
-/*
- * This function is copied from fileam.c in the 6X_STABLE branch.
- * In version 6, this function is no longer required to be copied.
- */
-static List *
-parseCopyFormatString(Relation rel, char *fmtstr, char fmttype)
-{
-       char       *token;
-       const char *whitespace = " \t\n\r";
-       char            nonstd_backslash = 0;
-       int                     encoding = GetDatabaseEncoding();
-       List       *l = NIL;
-
-       token = strtokx2(fmtstr, whitespace, NULL, NULL,
-                        0, false, true, encoding);
-
-       while (token)
-       {
-               bool            fetch_next;
-               DefElem    *item = NULL;
-
-               fetch_next = true;
-
-               if (pg_strcasecmp(token, "header") == 0)
-               {
-                       item = makeDefElem("header", (Node *)makeInteger(TRUE));
-               }
-               else if (pg_strcasecmp(token, "delimiter") == 0)
-               {
-                       token = strtokx2(NULL, whitespace, NULL, "'",
-                                        nonstd_backslash, true, true, 
encoding);
-                       if (!token)
-                               goto error;
-
-                       item = makeDefElem("delimiter", (Node 
*)makeString(pstrdup(token)));
-               }
-               else if (pg_strcasecmp(token, "null") == 0)
-               {
-                       token = strtokx2(NULL, whitespace, NULL, "'",
-                                        nonstd_backslash, true, true, 
encoding);
-                       if (!token)
-                               goto error;
-
-                       item = makeDefElem("null", (Node 
*)makeString(pstrdup(token)));
-               }
-               else if (pg_strcasecmp(token, "quote") == 0)
-               {
-                       token = strtokx2(NULL, whitespace, NULL, "'",
-                                        nonstd_backslash, true, true, 
encoding);
-                       if (!token)
-                               goto error;
-
-                       item = makeDefElem("quote", (Node 
*)makeString(pstrdup(token)));
-               }
-               else if (pg_strcasecmp(token, "escape") == 0)
-               {
-                       token = strtokx2(NULL, whitespace, NULL, "'",
-                                        nonstd_backslash, true, true, 
encoding);
-                       if (!token)
-                               goto error;
-
-                       item = makeDefElem("escape", (Node 
*)makeString(pstrdup(token)));
-               }
-               else if (pg_strcasecmp(token, "force") == 0)
-               {
-                       List       *cols = NIL;
-
-                       token = strtokx2(NULL, whitespace, ",", "\"",
-                                        0, false, false, encoding);
-                       if (pg_strcasecmp(token, "not") == 0)
-                       {
-                               token = strtokx2(NULL, whitespace, ",", "\"",
-                                                0, false, false, encoding);
-                               if (pg_strcasecmp(token, "null") != 0)
-                                       goto error;
-                               /* handle column list */
-                               fetch_next = false;
-                               for (;;)
-                               {
-                                       token = strtokx2(NULL, whitespace, ",", 
"\"",
-                                                        0, false, false, 
encoding);
-                                       if (!token || strchr(",", token[0]))
-                                               goto error;
-
-                                       cols = lappend(cols, 
makeString(pstrdup(token)));
-
-                                       /* consume the comma if any */
-                                       token = strtokx2(NULL, whitespace, ",", 
"\"",
-                                                        0, false, false, 
encoding);
-                                       if (!token || token[0] != ',')
-                                               break;
-                               }
-
-                               item = makeDefElem("force_not_null", (Node 
*)cols);
-                       }
-                       else if (pg_strcasecmp(token, "quote") == 0)
-                       {
-                               fetch_next = false;
-                               for (;;)
-                               {
-                                       token = strtokx2(NULL, whitespace, ",", 
"\"",
-                                                        0, false, false, 
encoding);
-                                       if (!token || strchr(",", token[0]))
-                                               goto error;
-
-                                       /*
-                                        * For a '*' token the format option is 
force_quote_all
-                                        * and we need to recreate the column 
list for the entire
-                                        * relation.
-                                        */
-                                       if (strcmp(token, "*") == 0)
-                                       {
-                                               int                     i;
-                                               TupleDesc       tupdesc = 
RelationGetDescr(rel);
-
-                                               for (i = 0; i < tupdesc->natts; 
i++)
-                                               {
-                                                       Form_pg_attribute att = 
tupdesc->attrs[i];
-
-                                                       if (att->attisdropped)
-                                                               continue;
-
-                                                       cols = lappend(cols, 
makeString(NameStr(att->attname)));
-                                               }
-
-                                               /* consume the comma if any */
-                                               token = strtokx2(NULL, 
whitespace, ",", "\"",
-                                                                0, false, 
false, encoding);
-                                               break;
-                                       }
-
-                                       cols = lappend(cols, 
makeString(pstrdup(token)));
-
-                                       /* consume the comma if any */
-                                       token = strtokx2(NULL, whitespace, ",", 
"\"",
-                                                        0, false, false, 
encoding);
-                                       if (!token || token[0] != ',')
-                                               break;
-                               }
-
-                               item = makeDefElem("force_quote", (Node *)cols);
-                       }
-                       else
-                               goto error;
-               }
-               else if (pg_strcasecmp(token, "fill") == 0)
-               {
-                       token = strtokx2(NULL, whitespace, ",", "\"",
-                                        0, false, false, encoding);
-                       if (pg_strcasecmp(token, "missing") != 0)
-                               goto error;
-
-                       token = strtokx2(NULL, whitespace, ",", "\"",
-                                        0, false, false, encoding);
-                       if (pg_strcasecmp(token, "fields") != 0)
-                               goto error;
-
-                       item = makeDefElem("fill_missing_fields", (Node 
*)makeInteger(TRUE));
-               }
-               else if (pg_strcasecmp(token, "newline") == 0)
-               {
-                       token = strtokx2(NULL, whitespace, NULL, "'",
-                                        nonstd_backslash, true, true, 
encoding);
-                       if (!token)
-                               goto error;
-
-                       item = makeDefElem("newline", (Node 
*)makeString(pstrdup(token)));
-               }
-               else
-                       goto error;
-
-               if (item)
-                       l = lappend(l, item);
-
-               if (fetch_next)
-                       token = strtokx2(NULL, whitespace, NULL, NULL,
-                                        0, false, false, encoding);
-       }
-
-       if (fmttype_is_text(fmttype))
-       {
-               /* TEXT is the default */
-       }
-       else if (fmttype_is_csv(fmttype))
-       {
-               /* Add FORMAT 'CSV' option to the beginning of the list */
-               l = lcons(makeDefElem("format", (Node *) makeString("csv")), l);
-       }
-       else
-               elog(ERROR, "unrecognized format type '%c'", fmttype);
-
-       return l;
-
-       error:
-       if (token)
-               ereport(ERROR,
-                       (errcode(ERRCODE_INTERNAL_ERROR),
-                               errmsg("external table internal parse error at 
\"%s\"",
-                                      token)));
-       else
-               ereport(ERROR,
-                       (errcode(ERRCODE_INTERNAL_ERROR),
-                               errmsg("external table internal parse error at 
end of line")));
-}
-
-/*
- * This function is copied from fileam.c in the 6X_STABLE branch.
- * In version 6, this function is no longer required to be copied.
- */
-static List *
-appendCopyEncodingOption(List *copyFmtOpts, int encoding)
-{
-       return lappend(copyFmtOpts, makeDefElem("encoding", (Node 
*)makeString((char *)pg_encoding_to_char(encoding))));
+       return lappend(copyFmtOpts,
+                                  makeDefElem("encoding",
+                                                          (Node *) 
makeString((char *) pg_encoding_to_char(encoding)),
+                                                          -1));
 }
-#endif
diff --git a/external-table/src/pxfheaders.h b/external-table/src/pxfheaders.h
index 9c864f12..9f2ec410 100644
--- a/external-table/src/pxfheaders.h
+++ b/external-table/src/pxfheaders.h
@@ -28,13 +28,9 @@
 #include "libchurl.h"
 #include "pxfuriparser.h"
 
-#if PG_VERSION_NUM >= 90400
 #include "nodes/execnodes.h"
 #include "nodes/nodeFuncs.h"
 #include "utils/rel.h"
-#else
-#include "optimizer/walkers.h"
-#endif
 
 /*
  * Contains the data necessary to build the HTTP headers required for calling 
on the pxf service
diff --git a/external-table/src/pxfprotocol.c b/external-table/src/pxfprotocol.c
index 4ccb1b96..bf5935ef 100644
--- a/external-table/src/pxfprotocol.c
+++ b/external-table/src/pxfprotocol.c
@@ -20,11 +20,7 @@
 
 #include "pxfbridge.h"
 #include "pxffilters.h"
-#if PG_VERSION_NUM >= 120000
 #include "extension/gp_exttable_fdw/extaccess.h"
-#else
-#include "access/fileam.h"
-#endif
 #include "utils/elog.h"
 
 /* define magic module unless run as a part of test cases */
diff --git a/external-table/src/pxfuriparser.c 
b/external-table/src/pxfuriparser.c
index eeee64d6..47fce006 100644
--- a/external-table/src/pxfuriparser.c
+++ b/external-table/src/pxfuriparser.c
@@ -291,13 +291,7 @@ GPHDUri_verify_no_duplicate_options(GPHDUri *uri)
        {
                OptionData *data = (OptionData *) lfirst(option);
 
-// For GP 5.x latest (5.29.8) the server_version_num is 80323.
-// For 6.x or later str_toupper doesn't work as it has different signature ( 
one extra parameter) so the asc_toupper will work for 6.x or 7.x
-#if PG_VERSION_NUM <= 80323
-               Value      *key = makeString(str_toupper(data->key, 
strlen(data->key)));
-#else
                Value      *key = makeString(asc_toupper(data->key, 
strlen(data->key)));
-#endif
 
                if (!list_member(previousKeys, key))
                        previousKeys = lappend(previousKeys, key);
diff --git a/external-table/src/pxfuriparser.h 
b/external-table/src/pxfuriparser.h
index f52de266..ec3f9ed7 100644
--- a/external-table/src/pxfuriparser.h
+++ b/external-table/src/pxfuriparser.h
@@ -24,10 +24,8 @@
 #include "nodes/pg_list.h"
 #include "fmgr.h"
 #include "utils/builtins.h"
-#if PG_VERSION_NUM >= 120000
 #include "lib/stringinfo.h"
 #include "nodes/value.h"
-#endif
 
 /*
  * Path constants for accessing PXF.
diff --git a/external-table/src/pxfutils.c b/external-table/src/pxfutils.c
index d8b2258d..19d7a8d1 100644
--- a/external-table/src/pxfutils.c
+++ b/external-table/src/pxfutils.c
@@ -1,9 +1,7 @@
 #include "pxfutils.h"
 
-#if PG_VERSION_NUM >= 90400
 #include "access/htup_details.h"
 #include "catalog/pg_type.h"
-#endif
 #include "catalog/pg_namespace.h"
 #include "utils/formatting.h"
 #include "utils/syscache.h"
@@ -22,13 +20,7 @@ normalize_key_name(const char *key)
                                (errcode(ERRCODE_INTERNAL_ERROR),
                                 errmsg("internal error in 
pxfutils.c:normalize_key_name. Parameter key is null or empty.")));
        }
-// For GP 5.x latest ( 5.29.8) the server_version_num is 80323.
-// For 6.x or later str_toupper doesn't work as it has different signature ( 
one extra parameter) so the asc_toupper will work for 6.x or 7.x
-#if PG_VERSION_NUM <= 80323
-       return psprintf("X-GP-OPTIONS-%s", str_toupper(pstrdup(key), 
strlen(key)));
-#else
        return psprintf("X-GP-OPTIONS-%s", asc_toupper(pstrdup(key), 
strlen(key)));
-#endif
 }
 
 /*
diff --git a/external-table/test/libchurl_test.c 
b/external-table/test/libchurl_test.c
index 32e51897..e1d4ce05 100644
--- a/external-table/test/libchurl_test.c
+++ b/external-table/test/libchurl_test.c
@@ -3,10 +3,8 @@
 #include <setjmp.h>
 #include "cmockery.h"
 
-#if PG_VERSION_NUM >= 90400
 #include "postgres.h"
 #include "utils/memutils.h"
-#endif
 
 /* Define UNIT_TESTING so that the extension can skip declaring 
PG_MODULE_MAGIC */
 #define UNIT_TESTING
@@ -131,9 +129,6 @@ test_churl_init_upload(void **state)
        assert_true(context->upload_buffer != NULL);
        assert_true(context->curl_handle != NULL);
        assert_true(context->multi_handle != NULL);
-#if PG_VERSION_NUM < 90400
-       assert_true(context->last_http_reponse == NULL);
-#endif
        assert_true(context->curl_still_running == 0);
 
        /* tear down */
@@ -177,9 +172,6 @@ test_churl_init_download(void **state)
        assert_true(context->upload_buffer != NULL);
        assert_true(context->curl_handle != NULL);
        assert_true(context->multi_handle != NULL);
-#if PG_VERSION_NUM < 90400
-       assert_true(context->last_http_reponse == NULL);
-#endif
 
        /* tear down */
        pfree(mock_curl_handle);
@@ -190,14 +182,9 @@ test_churl_init_download(void **state)
 
 /*  wrapper function to enable sideeffect testing with multiple parameters */
 static void
-#if PG_VERSION_NUM >= 90400
 write_callback_wrapper(void *ptr)
 {
        churl_context * user_context = (churl_context *) ptr;
-#else
-write_callback_wrapper(churl_context * user_context)
-{
-#endif
        write_callback(read_string, sizeof(char), strlen(read_string) + 1, 
user_context);
 }
 
diff --git a/external-table/test/mock/pxffragment_mock.c 
b/external-table/test/mock/pxffragment_mock.c
index 22c5b234..c522705d 100644
--- a/external-table/test/mock/pxffragment_mock.c
+++ b/external-table/test/mock/pxffragment_mock.c
@@ -16,26 +16,6 @@ get_fragments(GPHDUri *uri,
        mock();
 }
 
-#if PG_VERSION_NUM < 90400
-void
-call_rest(GPHDUri* hadoop_uri, ClientContext* client_context, char* rest_msg)
-{
-       check_expected(hadoop_uri);
-       check_expected(client_context);
-       check_expected(rest_msg);
-       optional_assignment(hadoop_uri);
-       optional_assignment(client_context);
-       optional_assignment(rest_msg);
-       mock();
-}
-
-static void
-process_request(ClientContext* client_context, char* uri)
-{
-       mock();
-}
-#endif
-
 void
 free_fragment(FragmentData *data)
 {
diff --git a/external-table/test/mock/pxfuriparser_mock.c 
b/external-table/test/mock/pxfuriparser_mock.c
index 7ab5aadb..f4ce8d9a 100644
--- a/external-table/test/mock/pxfuriparser_mock.c
+++ b/external-table/test/mock/pxfuriparser_mock.c
@@ -36,12 +36,3 @@ GPHDUri_verify_core_options_exist(GPHDUri *uri, List 
*coreoptions)
        mock();
 }
 
-#if PG_VERSION_NUM < 90400
-void
-GPHDUri_verify_cluster_exists(GPHDUri *uri, char* cluster)
-{
-       check_expected(uri);
-       check_expected(cluster);
-       mock();
-}
-#endif
diff --git a/external-table/test/pxfbridge_test.c 
b/external-table/test/pxfbridge_test.c
index 3a24a3f8..a979453f 100644
--- a/external-table/test/pxfbridge_test.c
+++ b/external-table/test/pxfbridge_test.c
@@ -3,10 +3,8 @@
 #include <setjmp.h>
 #include "cmockery.h"
 
-#if PG_VERSION_NUM >= 90400
 #include "postgres.h"
 #include "utils/memutils.h"
-#endif
 
 /* Define UNIT_TESTING so that the extension can skip declaring 
PG_MODULE_MAGIC */
 #define UNIT_TESTING
diff --git a/external-table/test/pxffilters_test.c 
b/external-table/test/pxffilters_test.c
index 6dd81eaa..d3e5612c 100644
--- a/external-table/test/pxffilters_test.c
+++ b/external-table/test/pxffilters_test.c
@@ -133,56 +133,6 @@ test__supported_operator_type_op_expr(void **state)
        }
 }
 
-#if PG_VERSION_NUM < 90400
-void
-test__supported_operator_type_scalar_array_op_expr(void **state)
-{
-       Oid operator_oids[15][2] = {
-                       {Int2EqualOperator, PXFOP_IN},
-                       {Int4EqualOperator, PXFOP_IN},
-                       {Int8EqualOperator, PXFOP_IN},
-                       {TextEqualOperator, PXFOP_IN},
-                       {Int24EqualOperator, PXFOP_IN},
-                       {Int42EqualOperator, PXFOP_IN},
-                       {Int84EqualOperator, PXFOP_IN},
-                       {Int48EqualOperator, PXFOP_IN},
-                       {Int28EqualOperator, PXFOP_IN},
-                       {Int82EqualOperator, PXFOP_IN},
-                       {DateEqualOperator, PXFOP_IN},
-                       {Float8EqualOperator, PXFOP_IN},
-                       {1120 , PXFOP_IN},
-                       {BPCharEqualOperator, PXFOP_IN},
-                       {BooleanEqualOperator, PXFOP_IN},
-       };
-
-       PxfFilterDesc *filter = (PxfFilterDesc*) palloc0(sizeof(PxfFilterDesc));
-
-       int array_size = sizeof(operator_oids) / sizeof(operator_oids[0]);
-       bool result = false;
-       int i = 0;
-
-       /* supported types */
-       for (; i < array_size-1; ++i)
-       {
-               result = 
supported_operator_type_scalar_array_op_expr(operator_oids[i][0], filter, true);
-               assert_true(result);
-               assert_true(operator_oids[i][1] == filter->op);
-       }
-
-       /* unsupported type */
-       result = supported_operator_type_op_expr(InvalidOid, filter);
-       assert_false(result);
-
-       /* go over pxf_supported_opr_scalar_array_op_expr array */
-       int nargs = sizeof(pxf_supported_opr_scalar_array_op_expr) / 
sizeof(dbop_pxfop_array_map);
-       assert_int_equal(nargs, 15);
-       for (i = 0; i < nargs; ++i)
-       {
-               
assert_true(supported_operator_type_scalar_array_op_expr(pxf_supported_opr_op_expr[i].dbop,
 filter, pxf_supported_opr_scalar_array_op_expr[i].useOr));
-               assert_true(pxf_supported_opr_scalar_array_op_expr[i].pxfop == 
filter->op);
-       }
-}
-#endif
 
 /*
  * const_value must be palloc'ed, it will be freed by scalar_const_to_str
@@ -560,11 +510,7 @@ build_null_expression_item(int attnum, Oid attrtype, 
NullTestType nullType)
 {
        ExpressionItem *expressionItem = (ExpressionItem*) 
palloc0(sizeof(ExpressionItem));
        Var *vararg = build_var(attrtype, attnum);
-#if PG_VERSION_NUM >= 90400
        NullTest *operationExpression = build_null_expr((Expr *) vararg, 
nullType);
-#else
-       OpExpr *operationExpression = build_null_expr(vararg, nullType);
-#endif
 
        expressionItem->node = (Node *) operationExpression;
        expressionItem->processed = false;
@@ -622,11 +568,7 @@ build_nested_func_expr_operand(List *columnsOids, List 
*attrsIndices)
        Var *var = NULL;
        List* args = NIL;
        forboth(columnOidLc, columnsOids, attrIndexLc, attrsIndices) {
-#if PG_VERSION_NUM >= 90400
                var = build_var(lfirst_oid(columnOidLc), 
lfirst_int(attrIndexLc));
-#else
-               var = build_var(lfirst(columnOidLc), lfirst(attrIndexLc));
-#endif
                args = lappend(args, var);
        }
        FuncExpr* operandImplicitCast = build_func_expr_operand(args, 
COERCE_IMPLICIT_CAST);
@@ -964,13 +906,8 @@ test__extractPxfAttributes_supported_function_one_arg(void 
**state) {
        int argumentColumnIndex = 6; // index starts from 0
        bool qualsAreSupported;
        qualsAreSupported = true;
-#if PG_VERSION_NUM >= 90400
        List* columnsOids = list_make1_oid(DATEOID);
        List* attrsIndices = list_make1_int(argumentColumnIndex);
-#else
-       List* columnsOids = list_make1(DATEOID);
-       List* attrsIndices = list_make1(argumentColumnIndex);
-#endif
 
        // Create operands FuncExpr, Const
        FuncExpr* leftop = build_nested_func_expr_operand(columnsOids, 
attrsIndices);
diff --git a/external-table/test/pxffragment_test.c 
b/external-table/test/pxffragment_test.c
index 90e60716..f88c6311 100644
--- a/external-table/test/pxffragment_test.c
+++ b/external-table/test/pxffragment_test.c
@@ -3,11 +3,9 @@
 #include <setjmp.h>
 #include "cmockery.h"
 
-#if PG_VERSION_NUM >= 90400
 #include "postgres.h"
 #include "utils/memutils.h"
 #include "cdb/cdbvars.h"
-#endif
 
 /* Define UNIT_TESTING so that the extension can skip declaring 
PG_MODULE_MAGIC */
 #define UNIT_TESTING
@@ -167,27 +165,6 @@ test_filter_fragments_for_segment(void **state)
        }
        PG_END_TRY();
 
-#if PG_VERSION_NUM < 90400
-       /* special case -- invalid transaction id */
-       old_context = CurrentMemoryContext;
-       PG_TRY();
-       {
-               test_list(0, 1, 0, 1, NULL, 0);
-               assert_false("Expected Exception");
-       }
-       PG_CATCH();
-       {
-               MemoryContextSwitchTo(old_context);
-               ErrorData  *edata = CopyErrorData();
-
-               assert_true(edata->elevel == ERROR);
-               char       *expected_message = pstrdup("Cannot get distributed 
transaction identifier in filter_fragments_for_segment");
-
-               assert_string_equal(edata->message, expected_message);
-               pfree(expected_message);
-       }
-       PG_END_TRY();
-#endif
 }
 
 static void
@@ -196,12 +173,10 @@ test_list(int segindex, int segtotal, int session_id, int 
fragtotal, char *expec
        /* prepare the input list */
        List       *list = prepare_fragment_list(fragtotal, segindex, segtotal, 
session_id);
 
-#if PG_VERSION_NUM >= 90400
        if (list)
        {
                will_return(getgpsegmentCount, segtotal);
        }
-#endif
 
        /* filter the list */
        List       *filtered = filter_fragments_for_segment(list);
@@ -230,15 +205,8 @@ static List *
 prepare_fragment_list(int fragtotal, int segindex, int segtotal, int 
session_id)
 {
        GpIdentity.segindex = segindex;
-#if PG_VERSION_NUM >= 90400
        gp_session_id = session_id;
        gp_command_count = 0;
-#else
-       GpIdentity.numsegments = segtotal;
-
-       if (fragtotal > 0)
-               will_return(getDistributedTransactionId, xid);
-#endif
 
        List       *result = NIL;
 
@@ -374,9 +342,6 @@ test_call_rest(void **state)
 
        expect_value(print_http_headers, headers, client_context->http_headers);
        will_be_called(print_http_headers);
-#if PG_VERSION_NUM < 90400
-       (client_context->http_headers);
-#endif
 
        StringInfoData expected_url;
 
diff --git a/external-table/test/pxfheaders_test.c 
b/external-table/test/pxfheaders_test.c
index 57ff1cb5..972939fc 100644
--- a/external-table/test/pxfheaders_test.c
+++ b/external-table/test/pxfheaders_test.c
@@ -22,11 +22,9 @@
 #include <setjmp.h>
 #include "cmockery.h"
 
-#if PG_VERSION_NUM >= 90400
 #include "postgres.h"
 #include "nodes/makefuncs.h"
 #include "utils/memutils.h"
-#endif
 
 /* Define UNIT_TESTING so that the extension can skip declaring 
PG_MODULE_MAGIC */
 #define UNIT_TESTING
@@ -121,9 +119,6 @@ expect_external_vars()
 static void
 test_build_http_headers(void **state)
 {
-#if PG_VERSION_NUM < 90400
-       const char *whitespace = " \t\n\r";
-#endif
        char            alignment[3];
        ExtTableEntry    ext_tbl;
        struct tupleDesc tuple;
@@ -137,25 +132,19 @@ test_build_http_headers(void **state)
        option_data2->key   = "key2";
        option_data2->value = "value2";
 
-#if PG_VERSION_NUM >= 90400
        List *copyOpts = NIL;
-       copyOpts = lappend(copyOpts, makeDefElem("format", (Node 
*)makeString("csv")));
-       copyOpts = lappend(copyOpts, makeDefElem("delimiter", (Node 
*)makeString("|")));
-       copyOpts = lappend(copyOpts, makeDefElem("null", (Node 
*)makeString("")));
-       copyOpts = lappend(copyOpts, makeDefElem("escape", (Node 
*)makeString("\"")));
-       copyOpts = lappend(copyOpts, makeDefElem("quote", (Node 
*)makeString("\"")));
-       copyOpts = lappend(copyOpts, makeDefElem("encoding", (Node 
*)makeString("UTF8")));
-#endif
+       copyOpts = lappend(copyOpts, makeDefElem("format", (Node 
*)makeString("csv"), -1));
+       copyOpts = lappend(copyOpts, makeDefElem("delimiter", (Node 
*)makeString("|"), -1));
+       copyOpts = lappend(copyOpts, makeDefElem("null", (Node 
*)makeString(""), -1));
+       copyOpts = lappend(copyOpts, makeDefElem("escape", (Node 
*)makeString("\""), -1));
+       copyOpts = lappend(copyOpts, makeDefElem("quote", (Node 
*)makeString("\""), -1));
+       copyOpts = lappend(copyOpts, makeDefElem("encoding", (Node 
*)makeString("UTF8"), -1));
 
        gphd_uri->options = list_make2(option_data1, option_data2);
 
        tuple.natts = 0;
        ext_tbl.fmtcode = 'c';
-#if PG_VERSION_NUM >= 90400
        ext_tbl.fmtopts = "delimiter '|' null '' escape '\"' quote '\"'";
-#else
-       ext_tbl.fmtopts = NULL;
-#endif
        ext_tbl.encoding = 6;
        input_data->rel->rd_id = 56;
        input_data->rel->rd_att = &tuple;
@@ -164,7 +153,6 @@ test_build_http_headers(void **state)
 
        expect_value(GetExtTableEntry, relid, input_data->rel->rd_id);
        will_return(GetExtTableEntry, &ext_tbl);
-#if PG_VERSION_NUM >= 90400
        expect_value(parseCopyFormatString, rel, input_data->rel);
        expect_value(parseCopyFormatString, fmtstr, ext_tbl.fmtopts);
        expect_value(parseCopyFormatString, fmttype, ext_tbl.fmtcode);
@@ -172,21 +160,8 @@ test_build_http_headers(void **state)
        expect_value(appendCopyEncodingOption, copyFmtOpts, copyOpts);
        expect_value(appendCopyEncodingOption, encoding, ext_tbl.encoding);
        will_return(appendCopyEncodingOption, copyOpts);
-#else
-       expect_value(strtokx2, s, NULL);
-       expect_value(strtokx2, whitespace, whitespace);
-       expect_value(strtokx2, delim, NULL);
-       expect_value(strtokx2, quote, NULL);
-       expect_value(strtokx2, escape, 0);
-       expect_value(strtokx2, e_strings, false);
-       expect_value(strtokx2, del_quotes, true);
-       expect_value(strtokx2, encoding, 0);
-       will_return(strtokx2, NIL);
-#endif
-
        expect_string(normalize_key_name, key, "format");
        will_return(normalize_key_name, pstrdup("X-GP-OPTIONS-FORMAT"));
-#if PG_VERSION_NUM >= 90400
        expect_string(normalize_key_name, key, "delimiter");
        will_return(normalize_key_name, pstrdup("X-GP-OPTIONS-DELIMITER"));
        expect_string(normalize_key_name, key, "null");
@@ -195,18 +170,15 @@ test_build_http_headers(void **state)
        will_return(normalize_key_name, pstrdup("X-GP-OPTIONS-ESCAPE"));
        expect_string(normalize_key_name, key, "quote");
        will_return(normalize_key_name, pstrdup("X-GP-OPTIONS-QUOTE"));
-#endif
        expect_string(normalize_key_name, key, "encoding");
        will_return(normalize_key_name, pstrdup("X-GP-OPTIONS-ENCODING"));
 
        expect_headers_append(input_data->headers, "X-GP-FORMAT", 
TextFormatName);
        expect_headers_append(input_data->headers, "X-GP-OPTIONS-FORMAT", 
"csv");
-#if PG_VERSION_NUM >= 90400
        expect_headers_append(input_data->headers, "X-GP-OPTIONS-DELIMITER", 
"|");
        expect_headers_append(input_data->headers, "X-GP-OPTIONS-NULL", "");
        expect_headers_append(input_data->headers, "X-GP-OPTIONS-ESCAPE", "\"");
        expect_headers_append(input_data->headers, "X-GP-OPTIONS-QUOTE", "\"");
-#endif
        expect_headers_append(input_data->headers, "X-GP-OPTIONS-ENCODING", 
"UTF8");
        expect_headers_append(input_data->headers, "X-GP-ATTRS", "0");
 
diff --git a/external-table/test/pxfprotocol_test.c 
b/external-table/test/pxfprotocol_test.c
index 76588d80..f19e6aeb 100644
--- a/external-table/test/pxfprotocol_test.c
+++ b/external-table/test/pxfprotocol_test.c
@@ -22,10 +22,8 @@
 #include <setjmp.h>
 #include "cmockery.h"
 
-#if PG_VERSION_NUM >= 90400
 #include "postgres.h"
 #include "utils/memutils.h"
-#endif
 
 /* Define UNIT_TESTING so that the extension can skip declaring 
PG_MODULE_MAGIC */
 #define UNIT_TESTING
diff --git a/external-table/test/pxfuriparser_test.c 
b/external-table/test/pxfuriparser_test.c
index b1050110..6f992533 100644
--- a/external-table/test/pxfuriparser_test.c
+++ b/external-table/test/pxfuriparser_test.c
@@ -22,10 +22,8 @@
 #include <setjmp.h>
 #include "cmockery.h"
 
-#if PG_VERSION_NUM >= 90400
 #include "postgres.h"
 #include "utils/memutils.h"
-#endif
 
 /* Define UNIT_TESTING so that the extension can skip declaring 
PG_MODULE_MAGIC */
 #define UNIT_TESTING
diff --git a/external-table/test/pxfutils_test.c 
b/external-table/test/pxfutils_test.c
index c04d9cfe..fef56be1 100644
--- a/external-table/test/pxfutils_test.c
+++ b/external-table/test/pxfutils_test.c
@@ -3,10 +3,8 @@
 #include <setjmp.h>
 #include "cmockery.h"
 
-#if PG_VERSION_NUM >= 90400
 #include "postgres.h"
 #include "utils/memutils.h"
-#endif
 
 /* Define UNIT_TESTING so that the extension can skip declaring 
PG_MODULE_MAGIC */
 #define UNIT_TESTING


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


Reply via email to