Trying to build mongo_fdw against PostgreSQL 11.0 using
./autogen.sh --with-master && \
make clean && \
make && \
make install
one runs into a few issues:
PG11 is not a supported version as per the Makfile(s)
[snip]
Makefile:47: *** PostgreSQL 9.3, 9.4, 9.5, 9.6 or 10.0 is required to compile this extension. Stop.
[snip]
PG11 requires use of the TupleDescAttr macro to access the attributes tuple descriptors
[snip]
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC --std=c99 -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0 -Ijson-c -DMETA_DRIVER -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5 -c -o mongo_fdw.o mongo_fdw.c
mongo_fdw.c: In function ‘MongoPlanForeignModify’:
mongo_fdw.c:658:29: error: incompatible types when initializing type ‘Form_pg_attribute {aka struct FormData_pg_attribute *}’ using type ‘FormData_pg_attribute {aka struct FormData_pg_attribute}’
Form_pg_attribute attr = tupdesc->attrs[attnum - 1];
^~~~~~~
In file included from mongo_fdw.h:56:0,
from mongo_wrapper.h:21,
from mongo_fdw.c:20:
mongo_fdw.c: In function ‘MongoBeginForeignModify’:
/usr/include/postgresql/11/server/utils/rel.h:434:36: error: incompatible types when initializing type ‘Form_pg_attribute {aka struct FormData_pg_attribute *}’ using type ‘FormData_pg_attribute {aka struct FormData_pg_attribute}’
#define RelationGetDescr(relation) ((relation)->rd_att)
^
mongo_fdw.c:749:28: note: in expansion of macro ‘RelationGetDescr’
Form_pg_attribute attr = RelationGetDescr(rel)->attrs[attnum - 1];
^~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:630:0,
from /usr/include/postgresql/11/server/c.h:61,
from /usr/include/postgresql/11/server/postgres.h:46,
from mongo_fdw.c:18:
mongo_fdw.c: In function ‘MongoExecForeignInsert’:
mongo_fdw.c:817:50: error: invalid type argument of ‘->’ (have ‘FormData_pg_attribute {aka struct FormData_pg_attribute}’)
if (strcmp(slot->tts_tupleDescriptor->attrs[0]->attname.data, "_id") != 0)
[snip]
Trying to build mongo_fdw against PostgreSQL 11.0 using
one runs into a few issues:
TupleDescAttr
macro to access the attributes tuple descriptorsget_relid_attribute_name()
I have fixed these issues, and can use mongo_fdw in PG11 successfully again for my use cases, PR to follow.