Skip to content

Commit 3a77c12

Browse files
committed
happy to get rid of about 70 lines of #ifdefs now that we are dropping support for pg12
1 parent 9a14309 commit 3a77c12

File tree

5 files changed

+7
-71
lines changed

5 files changed

+7
-71
lines changed

src/errors.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,11 @@ reportException(PyObject *pErrType, PyObject *pErrValue, PyObject *pErrTraceback
8181
{
8282
severity = ERROR;
8383
}
84-
#if PG_VERSION_NUM >= 130000
84+
8585
if (errstart(severity, TEXTDOMAIN))
86-
#else
87-
if (errstart(severity, __FILE__, __LINE__, PG_FUNCNAME_MACRO, TEXTDOMAIN))
88-
#endif
8986
{
90-
#if PG_VERSION_NUM >= 130000
87+
9188
if (errstart(severity, TEXTDOMAIN))
92-
#else
93-
if (errstart(severity, __FILE__, __LINE__, PG_FUNCNAME_MACRO, TEXTDOMAIN))
94-
#endif
9589
errmsg("Error in python: %s", errName);
9690
errdetail("%s", errValue);
9791
errdetail_log("%s", errTraceback);
@@ -102,11 +96,7 @@ reportException(PyObject *pErrType, PyObject *pErrValue, PyObject *pErrTraceback
10296
Py_DECREF(tracebackModule);
10397
Py_DECREF(newline);
10498
Py_DECREF(pTemp);
105-
#if PG_VERSION_NUM >= 130000
10699
errfinish(__FILE__, __LINE__, PG_FUNCNAME_MACRO);
107-
#else
108-
errfinish(0);
109-
#endif
110100
}
111101

112102
void reportMulticornException(PyObject* pErrValue)
@@ -133,11 +123,7 @@ void reportMulticornException(PyObject* pErrValue)
133123
PG_TRY();
134124
{
135125

136-
#if PG_VERSION_NUM >= 130000
137126
if (errstart(severity, TEXTDOMAIN))
138-
#else
139-
if (errstart(severity, __FILE__, __LINE__, PG_FUNCNAME_MACRO, TEXTDOMAIN))
140-
#endif
141127
{
142128
errmsg("%s", PyString_AsString(message));
143129
if (hint != NULL && hint != Py_None)
@@ -150,11 +136,7 @@ void reportMulticornException(PyObject* pErrValue)
150136
char* detailstr = PyString_AsString(detail);
151137
errdetail("%s", detailstr);
152138
}
153-
#if PG_VERSION_NUM >= 130000
154139
errfinish(__FILE__, __LINE__, PG_FUNCNAME_MACRO);
155-
#else
156-
errfinish(0);
157-
#endif
158140
}
159141

160142
}

src/multicorn.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
#include "utils/rel.h"
2727
#include "parser/parsetree.h"
2828
#include "fmgr.h"
29-
#if PG_VERSION_NUM >= 130000
3029
#include "common/hashfn.h" /* oid_hash */
31-
#endif
3230

3331

3432
PG_MODULE_MAGIC;

src/python.c

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -529,37 +529,25 @@ compareColumns(List *columns1, List *columns2)
529529
{
530530
return false;
531531
}
532-
#if PG_VERSION_NUM >= 130000
532+
533533
cell1 = lnext(coldef1, cell1);
534534
cell2 = lnext(coldef2, cell2);
535-
#else
536-
cell1 = lnext(cell1);
537-
cell2 = lnext(cell2);
538-
#endif
539535
/* Compare typoid */
540536
if (((Const *) (lfirst(cell1)))->constvalue != ((Const *) lfirst(cell2))->constvalue)
541537
{
542538
return false;
543539
}
544-
#if PG_VERSION_NUM >= 130000
540+
545541
cell1 = lnext(coldef1, cell1);
546542
cell2 = lnext(coldef2, cell2);
547-
#else
548-
cell1 = lnext(cell1);
549-
cell2 = lnext(cell2);
550-
#endif
551543
/* Compare typmod */
552544
if (((Const *) (lfirst(cell1)))->constvalue != ((Const *) lfirst(cell2))->constvalue)
553545
{
554546
return false;
555547
}
556-
#if PG_VERSION_NUM >= 130000
548+
557549
cell1 = lnext(coldef1, cell1);
558550
cell2 = lnext(coldef2, cell2);
559-
#else
560-
cell1 = lnext(cell1);
561-
cell2 = lnext(cell2);
562-
#endif
563551
/* Compare column options */
564552
if (!compareOptions(lfirst(cell1), lfirst(cell2)))
565553
{
@@ -954,11 +942,7 @@ execute(ForeignScanState *node, ExplainState *es)
954942
{
955943
expr_state = ExecInitExpr(((MulticornParamQual *) qual)->expr,
956944
(PlanState *) node);
957-
#if PG_VERSION_NUM >= 100000
958945
newqual->value = ExecEvalExpr(expr_state, econtext, &isNull);
959-
#else
960-
newqual->value = ExecEvalExpr(expr_state, econtext, &isNull, NULL);
961-
#endif
962946
}
963947
newqual->base.typeoid = ((Param*) ((MulticornParamQual *) qual)->expr)->paramtype;
964948
newqual->isnull = isNull;

src/query.c

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -870,49 +870,28 @@ deserializeDeparsedSortGroup(List *items)
870870
ListCell *lc;
871871
MulticornDeparsedSortGroup *key =
872872
palloc0(sizeof(MulticornDeparsedSortGroup));
873-
#if PG_VERSION_NUM >= 130000
873+
874874
List *list = lfirst(k);
875-
#endif
876875

877876
lc = list_head(lfirst(k));
878877
key->attname = (Name) strdup(strVal(lfirst(lc)));
879878

880-
#if PG_VERSION_NUM >= 130000
881879
lc = lnext(list, lc);
882-
#else
883-
lc = lnext(lc);
884-
#endif
885880
key->attnum = (int) intVal(lfirst(lc));
886881

887-
#if PG_VERSION_NUM >= 130000
888882
lc = lnext(list, lc);
889-
#else
890-
lc = lnext(lc);
891-
#endif
892883
key->reversed = (bool) intVal(lfirst(lc));
893884

894-
#if PG_VERSION_NUM >= 130000
895885
lc = lnext(list, lc);
896-
#else
897-
lc = lnext(lc);
898-
#endif
899886
key->nulls_first = (bool) intVal(lfirst(lc));
900887

901-
#if PG_VERSION_NUM >= 130000
902888
lc = lnext(list, lc);
903-
#else
904-
lc = lnext(lc);
905-
#endif
906889
if(lfirst(lc) != NULL)
907890
key->collate = (Name) strdup(strVal(lfirst(lc)));
908891
else
909892
key->collate = NULL;
910893

911-
#if PG_VERSION_NUM >= 130000
912894
lc = lnext(list, lc);
913-
#else
914-
lc = lnext(lc);
915-
#endif
916895
key->key = (PathKey *) lfirst(lc);
917896

918897
result = lappend(result, key);

src/utils.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,8 @@ log_to_postgres(PyObject *self, PyObject *args, PyObject *kwargs)
8181
}
8282
hint = PyDict_GetItemString(kwargs, "hint");
8383
detail = PyDict_GetItemString(kwargs, "detail");
84-
#if PG_VERSION_NUM >= 130000
84+
8585
if (errstart(severity, TEXTDOMAIN))
86-
#else
87-
if (errstart(severity, __FILE__, __LINE__, PG_FUNCNAME_MACRO, TEXTDOMAIN))
88-
#endif
8986
{
9087
errmsg("%s", message);
9188
if (hint != NULL && hint != Py_None)
@@ -100,11 +97,7 @@ log_to_postgres(PyObject *self, PyObject *args, PyObject *kwargs)
10097
}
10198
Py_DECREF(args);
10299
Py_DECREF(kwargs);
103-
#if PG_VERSION_NUM >= 130000
104100
errfinish(__FILE__, __LINE__, PG_FUNCNAME_MACRO);
105-
#else
106-
errfinish(0);
107-
#endif
108101
}
109102
else
110103
{

0 commit comments

Comments
 (0)