1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
From 225a858d1317618ac322bc3ffe7c6b75d6e9c8c1 Mon Sep 17 00:00:00 2001
From: Jeff Janes <jeff.janes@gmail.com>
Date: Tue, 21 Aug 2018 16:55:44 -0400
Subject: [PATCH] Update for PostgreSQL v11
The old way of accessing attributes has finally been removed
in favor of TupleDescAttr, so change the code to use that
macro. This Macro exists back to 9.2.
This fixes issue #206.
---
src/multicorn.c | 6 +++---
src/python.c | 8 ++++----
src/query.c | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/multicorn.c b/src/multicorn.c
index ab483759..d0b1c80b 100644
--- a/src/multicorn.c
+++ b/src/multicorn.c
@@ -257,7 +257,7 @@ multicornGetForeignRelSize(PlannerInfo *root,
for (i = 0; i < desc->natts; i++)
{
- Form_pg_attribute att = desc->attrs[i];
+ Form_pg_attribute att = TupleDescAttr(desc, i);
if (!att->attisdropped)
{
@@ -599,7 +599,7 @@ multicornAddForeignUpdateTargets(Query *parsetree,
for (i = 0; i < desc->natts; i++)
{
- Form_pg_attribute att = desc->attrs[i];
+ Form_pg_attribute att = TupleDescAttr(desc, i);
if (!att->attisdropped)
{
@@ -681,7 +681,7 @@ multicornBeginForeignModify(ModifyTableState *mtstate,
}
for (i = 0; i < desc->natts; i++)
{
- Form_pg_attribute att = desc->attrs[i];
+ Form_pg_attribute att = TupleDescAttr(desc, i);
if (!att->attisdropped)
{
diff --git a/src/python.c b/src/python.c
index 2f9fd803..cbd560b0 100644
--- a/src/python.c
+++ b/src/python.c
@@ -459,7 +459,7 @@ getColumnsFromTable(TupleDesc desc, PyObject **p_columns, List **columns)
for (i = 0; i < desc->natts; i++)
{
- Form_pg_attribute att = desc->attrs[i];
+ Form_pg_attribute att = TupleDescAttr(desc, i);
if (!att->attisdropped)
{
@@ -1214,7 +1214,7 @@ pythonDictToTuple(PyObject *p_value,
for (i = 0; i < slot->tts_tupleDescriptor->natts; i++)
{
char *key;
- Form_pg_attribute attr = slot->tts_tupleDescriptor->attrs[i];
+ Form_pg_attribute attr = TupleDescAttr(slot->tts_tupleDescriptor,i);
AttrNumber cinfo_idx = attr->attnum - 1;
if (cinfos[cinfo_idx] == NULL)
@@ -1263,7 +1263,7 @@ pythonSequenceToTuple(PyObject *p_value,
for (i = 0, j = 0; i < slot->tts_tupleDescriptor->natts; i++)
{
PyObject *p_object;
- Form_pg_attribute attr = slot->tts_tupleDescriptor->attrs[i];
+ Form_pg_attribute attr = TupleDescAttr(slot->tts_tupleDescriptor,i);
AttrNumber cinfo_idx = attr->attnum - 1;
if (cinfos[cinfo_idx] == NULL)
@@ -1658,7 +1658,7 @@ tupleTableSlotToPyObject(TupleTableSlot *slot, ConversionInfo ** cinfos)
for (i = 0; i < tupdesc->natts; i++)
{
- Form_pg_attribute attr = tupdesc->attrs[i];
+ Form_pg_attribute attr = TupleDescAttr(tupdesc,i);
bool isnull;
Datum value;
PyObject *item;
diff --git a/src/query.c b/src/query.c
index 40461157..3b51f3e7 100644
--- a/src/query.c
+++ b/src/query.c
@@ -103,7 +103,7 @@ initConversioninfo(ConversionInfo ** cinfos, AttInMetadata *attinmeta)
for (i = 0; i < attinmeta->tupdesc->natts; i++)
{
- Form_pg_attribute attr = attinmeta->tupdesc->attrs[i];
+ Form_pg_attribute attr = TupleDescAttr(attinmeta->tupdesc,i);
Oid outfuncoid;
bool typIsVarlena;
|