Opened 4 years ago

Closed 4 years ago

#4663 closed defect (fixed)

Remove unnecessary #include

Reported by: Laurenz Albe Owned by: pramsey
Priority: medium Milestone:
Component: postgis Version: master
Keywords: Cc:

Description

PostgreSQL v13 has split access/tuptoaster.h into several files, so building PostGIS with current PostgreSQL master fails.

However, it seems that the #include is not really required, so the attached patch simply removes it. I didn't test, but I don't think it creates problems with older PostgreSQL versions as well.

Attachments (2)

0001-Remove-unnecessary-include.patch (732 bytes ) - added by Laurenz Albe 4 years ago.
0001-Change-include-for-VARATT_EXTERNAL_GET_POINTER.patch (770 bytes ) - added by Laurenz Albe 4 years ago.

Download all attachments as: .zip

Change History (8)

by Laurenz Albe, 4 years ago

comment:1 by Algunenano, 4 years ago

It breaks, at least, PG12:

lwgeom_cache.c: In function 'ToastCacheGetGeometry':
lwgeom_cache.c:283:2: error: implicit declaration of function 'VARATT_EXTERNAL_GET_POINTER' [-Werror=implicit-function-declaration]
  283 |  VARATT_EXTERNAL_GET_POINTER(ve, attr);

comment:2 by Laurenz Albe, 4 years ago

Yes, I noticed that when building. Here is a second patch that fixes the problem - we need the #include after all.

comment:3 by Laurenz Albe, 4 years ago

Note that this patch will only work for v13.

It would need conditional compilation to make this work with all PostgreSQL versions.

comment:4 by Algunenano, 4 years ago

Thanks.

I think something like:

#if POSTGIS_PGSQL_VERSION < 130
#include "access/tuptoaster.h"
#else
#include "access/detoast.h"
#endif

fixes both compilations.

I'm going to update out PG13 image which was broken because of other dependencies and see if that fixes the Travis build too.

comment:5 by Algunenano, 4 years ago

Pushing the fix to close this issue and I'll open a different one to fix the latest build, which is failing because of sfcgal changes in the build (the changed the placement of static libraries and added a pkg-config)

comment:6 by Raúl Marín <git@…>, 4 years ago

Resolution: fixed
Status: newclosed

In d978bb4/git:

PG13: Change #include for VARATT_EXTERNAL_GET_POINTER

PostgreSQL v13 has split "tuptoaster.h" into three files, so we
have to include "detoast.h" now.

Initial patch by Laurenz Albe

Closes #4663

Note: See TracTickets for help on using tickets.