pramsey / pgsql-ogr-fdw

PostgreSQL foreign data wrapper for OGR
MIT License
237 stars 34 forks source link

Doesn't compile against PostgreSQL 12 head #160

Closed robe2 closed 5 years ago

robe2 commented 5 years ago

In file included from ogr_fdw.c:37: ogr_fdw.h:40:10: fatal error: nodes/relation.h: No such file or directory

include "nodes/relation.h"

^~~~~~ compilation terminated. make: *** [: ogr_fdw.o] Error 1

robe2 commented 5 years ago

I found the commit that broke this:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=fa2cf164aaf91e074be653c28e035f65d80eb666

`Rename nodes/relation.h to nodes/pathnodes.h.

The old name of this file was never a very good indication of what it was for. Now that there's also access/relation.h, we have a potential confusion hazard as well, so let's rename it to something more apropos. Per discussion, "pathnodes.h" is reasonable, since a good fraction of the file is Path node definitions.

While at it, tweak a couple of other headers that were gratuitously importing relation.h into modules that don't need it.

Discussion: https://postgr.es/m/7719.1548688728@sss.pgh.pa.us`

I'll submit a patch later after I patch and test

robe2 commented 5 years ago

Bah evidentally more than that standing in the way:

In file included from ogr_fdw.c:37: ogr_fdw.h:50:10: fatal error: optimizer/var.h: No such file or directory

include "optimizer/var.h"

^~~~~ compilation terminated. make: *** [: ogr_fdw.o] Error 1 gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 -I/projects/gdal/rel-2.4.0w64gcc81/include -I. -I./ -IC:/MING64~1/projects/POSTGR~1/rel/PG12W6~1/include/server -IC:/MING64~1/projects/POSTGR~1/rel/PG12W6~1/include/internal -I/projects/zlib/rel-zlib-1.2.11w64gcc81/include -I/projects/libxml/rel-libxml2-2.7.8w64gcc81/include -I./src/include/port/win32 -DEXEC_BACKEND -I/projects/libxml/rel-libxml2-2.7.8w64gcc81/include/libxml2 -IC:/MING64~1/projects/POSTGR~1/rel/PG12W6~1/include/server/port/win32 -c -o ogr_fdw.o ogr_fdw.c In file included from ogr_fdw.c:37: ogr_fdw.h:50:10: fatal error: optimizer/var.h: No such file or directory

include "optimizer/var.h"

^~~~~ compilation terminated. make: *** [: ogr_fdw.o] Error 1

Caused by commit:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=f09346a9c6218dd239fdf3a79a729716c0d305bd

Refactor planner's header files.

Create a new header optimizer/optimizer.h, which exposes just the planner functions that can be used "at arm's length", without need to access Paths or the other planner-internal data structures defined in nodes/relation.h. This is intended to provide the whole planner API seen by most of the rest of the system; although FDWs still need to use additional stuff, and more thought is also needed about just what selfuncs.c should rely on.

The main point of doing this now is to limit the amount of new

include baggage that will be needed by "planner support functions",

which I expect to introduce later, and which will be in relevant datatype modules rather than anywhere near the planner.

This commit just moves relevant declarations into optimizer.h from other header files (a couple of which go away because everything got moved), and adjusts #include lists to match. There's further cleanup that could be done if we want to decide that some stuff being exposed by optimizer.h doesn't belong in the planner at all, but I'll leave that for another day.

robe2 commented 5 years ago

Okay got to compile after replacing optimizer/var.h with optimizer/optimizer.h

and taking out T_ArrayRef (what is that for exactly) in ogr_fdw_deparse.c. I'm trying to find the replacement for it the debugger gave this, but I haven't tried replacing that with T_ParamRef and not sure how to test if it works or not

ogr_fdw_deparse.c: In function 'ogrDeparseExpr': ogr_fdw_deparse.c:524:8: error: 'T_ArrayRef' undeclared (first use in this function); did you mean 'T_ParamRef'? case T_ArrayRef: ^~~~~~ T_ParamRef ogr_fdw_deparse.c:524:8: note: each undeclared identifier is reported only once for each function it appears in make: *** [: ogr_fdw_deparse.o] Error 1 C:/MING64~1/projects/POSTGR~1/rel/PG12W6~1/lib/pgxs/src/MAKEFI~1/../../src/test/regress/pg_regress --inputdir=./ --bindir='C:/MING64~1/projects/POSTGR~1/rel/PG12W6~1/bin' --encoding=UTF8 --dbname=contrib_regression file pgsql import

I also suspect you don't need optimizer/cost.h as I noticed @adunstan took it out of his file text array fdw at https://github.com/adunstan/file_text_array_fdw/commit/dd005ac0d9a3ff2305292e49653bf06b73df8ba2

pramsey commented 5 years ago

I have committed a clean build, but regression fails. There's something more deeply changed in the FDW code I think, as I'm seeing a bunch of zeroed out data coming through the slot handler when it should have data.