tds-fdw / tds_fdw

A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Other
381 stars 102 forks source link

2.0.0-alpha2 build error against PostgreSQL 11 #182

Closed devrimgunduz closed 5 years ago

devrimgunduz commented 6 years ago

Hi, 2.0.0-alpha2 throws errors while building against PostgreSQL 11. Can you please take a look?

Thanks!

`/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I./include/ -fvisibility=hidden -I. -I./ -I/usr/pgsql-11/include/server -I/usr/pgsql-11/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o src/deparse.bc src/deparse.c src/deparse.c: In function 'deparse_type_name': src/deparse.c:698:10: warning: implicit declaration of function 'format_type_with_typemod_qualified'; did you mean 'format_type_with_typemod'? [-Wimplicit-function-declaration] return format_type_with_typemod_qualified(type_oid, typemod); ^~~~~~~~~~ format_type_with_typemod src/deparse.c:698:10: warning: returning 'int' from a function with return type 'char ' makes pointer from integer without a cast [-Wint-conversion] return format_type_with_typemod_qualified(type_oid, typemod); ^~~~~~~~~~~~~ src/deparse.c: In function 'deparseTargetList': src/deparse.c:811:28: 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[i - 1]; ^~~ src/deparse.c: In function 'deparseAnalyzeSql': src/deparse.c:1125:24: error: invalid type argument of '->' (have 'FormData_pg_attribute' {aka 'struct FormData_pg_attribute'}) if (tupdesc->attrs[i]->attisdropped) ^~ In file included from /usr/pgsql-11/include/server/postgres.h:46, from src/deparse.c:52: src/deparse.c:1133:38: error: invalid type argument of '->' (have 'FormData_pg_attribute' {aka 'struct FormData_pg_attribute'}) colname = NameStr(tupdesc->attrs[i]->attname); ^~ /usr/pgsql-11/include/server/c.h:576:25: note: in definition of macro 'NameStr'

define NameStr(name) ((name).data)

                     ^~~~

src/deparse.c: In function 'deparseColumnRef': src/deparse.c:1202:13: warning: implicit declaration of function 'get_relid_attribute_name'; did you mean 'get_rte_attribute_name'? [-Wimplicit-function-declaration] colname = get_relid_attribute_name(rte->relid, varattno); ^~~~~~~~ get_rte_attribute_name src/deparse.c:1202:11: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion] colname = get_relid_attribute_name(rte->relid, varattno); ^ make[1]: [: src/deparse.o] Error 1 make[1]: Waiting for unfinished jobs.... src/tds_fdw.c: In function 'tdsGetColumnMetadata': src/tds_fdw.c:1395:72: error: invalid type argument of '->' (have 'FormData_pg_attribute' {aka 'struct FormData_pg_attribute'}) column->attr_oid = festate->attinmeta->tupdesc->attrs[local_ncol]->atttypid; ^~ src/tds_fdw.c:1404:65: error: invalid type argument of '->' (have 'FormData_pg_attribute' {aka 'struct FormData_pg_attribute'}) local_name = festate->attinmeta->tupdesc->attrs[local_ncol]->attname.data; ^~ src/tds_fdw.c:1417:72: error: invalid type argument of '->' (have 'FormData_pg_attribute' {aka 'struct FormData_pg_attribute'}) column->attr_oid = festate->attinmeta->tupdesc->attrs[local_ncol]->atttypid; ^~ src/tds_fdw.c:1443:63: error: invalid type argument of '->' (have 'FormData_pg_attribute' {aka 'struct FormData_pg_attribute'}) column->attr_oid = festate->attinmeta->tupdesc->attrs[ncol]->atttypid; ^~ In file included from /usr/pgsql-11/include/server/postgres.h:47, from src/tds_fdw.c:32: src/tds_fdw.c:1461:47: error: invalid type argument of '->' (have 'FormData_pg_attribute' {aka 'struct FormData_pg_attribute'}) festate->attinmeta->tupdesc->attrs[ncol]->attname.data) ^~ /usr/pgsql-11/include/server/utils/elog.h:107:14: note: in definition of macro 'ereport_domain' errfinish rest; \ ^~~~ src/tds_fdw.c:1457:5: note: in expansion of macro 'ereport' ereport(WARNING, ^~~ make[1]: ** [: src/tds_fdw.o] Error 1 src/deparse.c:698:10: warning: implicit declaration of function 'format_type_with_typemod_qualified' is invalid in C99 [-Wimplicit-function-declaration] return format_type_with_typemod_qualified(type_oid, typemod); ^ src/deparse.c:698:10: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'char ' [-Wint-conversion] return format_type_with_typemod_qualified(type_oid, typemod); ^~~~~~~~~~~~~ src/deparse.c:811:21: error: initializing 'Form_pg_attribute' (aka 'struct FormData_pg_attribute *') with an expression of incompatible type 'FormData_pg_attribute' (aka 'struct FormData_pg_attribute'); take the address with & Form_pg_attribute attr = tupdesc->attrs[i - 1]; ^ ~~~~~ & src/deparse.c:1125:24: error: member reference type 'FormData_pg_attribute' (aka 'struct FormData_pg_attribute') is not a pointer; did you mean to use '.'? if (tupdesc->attrs[i]->attisdropped)


                                     .
src/deparse.c:1133:38: error: member reference type 'FormData_pg_attribute' (aka 'struct FormData_pg_attribute') is not a pointer; did you mean to use '.'?
                colname = NameStr(tupdesc->attrs[i]->attname);
                                  ~~~~~~~~~~~~~~~~~^~
                                                   .
/usr/pgsql-11/include/server/c.h:576:25: note: expanded from macro 'NameStr'
#define NameStr(name)   ((name).data)
                          ^~~~
src/deparse.c:1202:13: warning: implicit declaration of function 'get_relid_attribute_name' is invalid in C99 [-Wimplicit-function-declaration]
                colname = get_relid_attribute_name(rte->relid, varattno);
                          ^
src/deparse.c:1202:11: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
                colname = get_relid_attribute_name(rte->relid, varattno);
                        ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings and 3 errors generated.
make[1]: *** [/usr/pgsql-11/lib/pgxs/src/makefiles/../../src/Makefile.global:1010: src/deparse.bc] Error 1
src/tds_fdw.c:1395:72: error: member reference type 'FormData_pg_attribute' (aka 'struct FormData_pg_attribute') is not a pointer; did you mean to use '.'?
                                                column->attr_oid = festate->attinmeta->tupdesc->attrs[local_ncol]->atttypid;
                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                                                                                                 .
src/tds_fdw.c:1404:65: error: member reference type 'FormData_pg_attribute' (aka 'struct FormData_pg_attribute') is not a pointer; did you mean to use '.'?
                                        local_name = festate->attinmeta->tupdesc->attrs[local_ncol]->attname.data;
                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                                                                                   .
src/tds_fdw.c:1417:72: error: member reference type 'FormData_pg_attribute' (aka 'struct FormData_pg_attribute') is not a pointer; did you mean to use '.'?
                                                column->attr_oid = festate->attinmeta->tupdesc->attrs[local_ncol]->atttypid;
                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                                                                                                 .
src/tds_fdw.c:1443:63: error: member reference type 'FormData_pg_attribute' (aka 'struct FormData_pg_attribute') is not a pointer; did you mean to use '.'?
                        column->attr_oid = festate->attinmeta->tupdesc->attrs[ncol]->atttypid;
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                                                                   .
src/tds_fdw.c:1461:47: error: member reference type 'FormData_pg_attribute' (aka 'struct FormData_pg_attribute') is not a pointer; did you mean to use '.'?
                                        festate->attinmeta->tupdesc->attrs[ncol]->attname.data)
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                                                                .
/usr/pgsql-11/include/server/utils/elog.h:123:37: note: expanded from macro 'ereport'
        ereport_domain(elevel, TEXTDOMAIN, rest)
                                           ^~~~
/usr/pgsql-11/include/server/utils/elog.h:107:14: note: expanded from macro 'ereport_domain'
                        errfinish rest; \
                                  ^~~~
5 errors generated.
make[1]: *** [/usr/pgsql-11/lib/pgxs/src/makefiles/../../src/Makefile.global:1010: src/tds_fdw.bc] Error 1`
donnorman commented 6 years ago

I was getting the same errors as you when trying to build from a release package.

The v11 changes are in the master branch if you build from the repository though.

Here's a list of the v11 changes that were incorporated: https://github.com/tds-fdw/tds_fdw/pull/169

Also, if you are running the LLVM JIT build (postgresql11-llvmjit.x86_64) you might need extra tools to make/install.

If you are on CentOS (7.5), this is what I did:

yum install centos-release-scl
yum install devtoolset-7
scl enable devtoolset-7 bash
yum install llvm5.0
yum install llvm-toolset-7-clang
ghost commented 6 years ago

Using alpine (via docker) I show no build failure. Testing the table definitions, I am getting no errors and the data loads fine. Can you try building from source directly? Also, can you describe your build context (OS version)?

juliogonzalez commented 5 years ago

Confirmed on both CentOS6 and Ubuntu 14.04 using the tag v2.0.0-alpha.2: https://jenkins.juliogonzalez.es/job/tds_fdw-build-free/59/ (ignore PostgreSQL10 failure for Ubuntu 14.04, it's a CI problem that was not fixed for that tag).

juliogonzalez commented 5 years ago

@devrimgunduz, can the issue be closed?

devrimgunduz commented 5 years ago

@juliogonzalez Any chance you can roll a new alpha or so? RPMs depend on released tarballs -- so that I can test.

juliogonzalez commented 5 years ago

@devrimgunduz, I am afraid that depends on @GeoffMontee rather than me.

@GeoffMontee, maybe we should consider releasing Alpha2, so I can update https://github.com/juliogonzalez/tds_fdw-rpm as well, and include support for new PostgreSQL versions.

Then the development can be continued for Alpha3.

What do you think?

GeoffMontee commented 5 years ago

@juliogonzalez,

It looks like we already had an alpha2, so I made an alpha3.

@devrimgunduz,

You can find it here:

https://github.com/tds-fdw/tds_fdw/releases/tag/v2.0.0-alpha.3

juliogonzalez commented 5 years ago

RPM is on its way and under testing now. I will publish it tomorrow.

GeoffMontee commented 5 years ago

Thanks, @juliogonzalez!

juliogonzalez commented 5 years ago

I added yesterday to the project the SPECs I use to generate RPMs: https://github.com/tds-fdw/rpm

As a bonus, now we have a Yum repository with the packages starting with 2.0.0-alpha3: https://tds-fdw.github.io/yum/ (instructions to use it are pending approval at https://github.com/tds-fdw/tds_fdw/pull/194)

@devrimgunduz, can this issue be closed?

devrimgunduz commented 5 years ago

Thanks @juliogonzalez ! I updated the packages in the YUM repo.

Regards, Devrim