Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3758 closed defect (fixed)

PostgreSQL 10 beta1 fails compile in gserialized_estimate

Reported by: robe Owned by: pramsey
Priority: blocker Milestone: PostGIS 2.4.0
Component: postgis Version: master
Keywords: Cc:

Description

Looks like they changed API in PostgreSQL 10 now.

On compile get error:

gserialized_estimate.c:1:0: warning: -fPIC ignored for target (all code is position independent)
 /**********************************************************************
 ^
gserialized_estimate.c: In function 'pg_nd_stats_from_tuple':
gserialized_estimate.c:829:25: warning: passing argument 1 of 'get_attstatsslot' from incompatible pointer type
   rv = get_attstatsslot(stats_tuple, 0, 0, stats_kind, InvalidOid,
                         ^
In file included from gserialized_estimate.c:69:0:
C:/MING64~1/projects/POSTGR~1/rel/PG10W6~1/include/server/utils/lsyscache.h:173:13: note: expected 'struct AttStatsSlot *' but argument is of type 'HeapTuple'
 extern bool get_attstatsslot(AttStatsSlot *sslot, HeapTuple statstuple,
             ^
gserialized_estimate.c:829:8: error: too many arguments to function 'get_attstatsslot'
   rv = get_attstatsslot(stats_tuple, 0, 0, stats_kind, InvalidOid,
        ^
In file included from gserialized_estimate.c:69:0:
C:/MING64~1/projects/POSTGR~1/rel/PG10W6~1/include/server/utils/lsyscache.h:173:13: note: declared here
 extern bool get_attstatsslot(AttStatsSlot *sslot, HeapTuple statstuple,
             ^
gserialized_estimate.c:842:3: error: too many arguments to function 'free_attstatsslot'
   free_attstatsslot(0, NULL, 0, floatptr, nvalues);
   ^
In file included from gserialized_estimate.c:69:0:
C:/MING64~1/projects/POSTGR~1/rel/PG10W6~1/include/server/utils/lsyscache.h:175:13: note: declared here
 extern void free_attstatsslot(AttStatsSlot *sslot);
             ^

Change History (7)

comment:1 by robe, 8 years ago

Summary: PosdtgreSQL 10 beta1 fails compile in gserialized_estimatePostgreSQL 10 beta1 fails compile in gserialized_estimate

comment:2 by robe, 8 years ago

In 15398:

PostgreSQL 10 beta1 fails compile in gserialized_estimate
Revise to use new api for get_attstatsslot function for PostgreSQL ≥ 10
References #3758

comment:3 by robe, 8 years ago

After I made the change in r15398, it compiles and now get same as before:

PostgreSQL 10beta1 on x86_64-w64-mingw32, compiled by gcc.exe (x86_64-win32-seh-rev4, Built by MinGW-W64 project) 4.9.2, 64-bit
  Postgis 2.4.0dev - r15397 - 2017-05-21 03:07:57
  scripts 2.4.0dev r15397
  GEOS: 3.7.0dev-CAPI-1.11.0 8fe2ce6
  PROJ: Rel. 4.9.1, 04 March 2015
  SFCGAL: 1.3.0

Running tests

 loader/Point .............. ok
 loader/PointM .............. ok
 loader/PointZ .............. ok
 loader/MultiPoint .............. ok
 loader/MultiPointM .............. ok
 loader/MultiPointZ .............. ok
 loader/Arc .............. ok
 loader/ArcM .............. ok
 loader/ArcZ .............. ok
 loader/Polygon .............. ok
 loader/PolygonM .............. ok
 loader/PolygonZ .............. ok
 loader/TSTPolygon ......... ok
 loader/TSIPolygon ......... ok
 loader/TSTIPolygon ......... ok
 loader/PointWithSchema ..... ok
 loader/NoTransPoint ......... ok
 loader/NotReallyMultiPoint ......... ok
 loader/MultiToSinglePoint ......... ok
 loader/ReprojectPts ........ ok
 loader/ReprojectPtsGeog ........ ok
 loader/Latin1 .... ok
 loader/Latin1-implicit .... ok
 loader/mfile .... ok
 dumper/literalsrid ....... ok
 dumper/realtable ....... ok
 affine .. ok
 bestsrid .. ok
 binary .. ok
 boundary .. ok
 cluster .. ok
 concave_hull .. ok
 ctors .. ok
 dump .. ok
 dumppoints .. ok
 empty .. ok
 estimatedextent .. ok
 forcecurve .. ok
 geography .. ok
 geometric_median .. ok
 in_geohash .. ok
 in_gml .. ok
 in_kml .. ok
 in_encodedpolyline .. ok
 iscollection .. ok
 legacy .. ok
 long_xact .. ok
 lwgeom_regress .. ok
 measures .. ok
 minimum_bounding_circle .. ok
 normalize .. ok
 operators .. ok
 orientation .. ok
 out_geometry .. ok
 out_geography .. ok
 polygonize .. ok
 polyhedralsurface .. ok
 postgis_type_name .. ok
 regress .. ok
 regress_bdpoly .. ok
 regress_index .. ok
 regress_index_nulls .. ok
 regress_management .. ok
 regress_selectivity .. failed (diff expected obtained: /projects/postgis/tmp/2.4_pg10w64/test_64_diff)
 regress_lrs .. ok
 regress_ogc .. ok
 regress_ogc_cover .. ok
 regress_ogc_prep .. ok
 regress_proj .. ok
 relate .. ok
 remove_repeated_points .. ok
 removepoint .. ok
 setpoint .. ok
 simplify .. ok
 simplifyvw .. ok
 size .. ok
 snaptogrid .. ok
 split .. ok
 sql-mm-serialize .. ok
 sql-mm-circularstring .. ok
 sql-mm-compoundcurve .. ok
 sql-mm-curvepoly .. ok
 sql-mm-general .. ok
 sql-mm-multicurve .. ok
 sql-mm-multisurface .. ok
 swapordinates .. ok
 summary .. ok
 temporal .. ok
 tickets .. ok
 twkb .. ok
 typmod .. ok
 wkb .. ok
 wkt .. ok
 wmsservers .. ok
 knn_recheck .. ok
 temporal_knn .. ok
 hausdorff .. ok
 regress_buffer_params .. ok
 offsetcurve .. ok
 relatematch .. ok
 isvaliddetail .. ok
 sharedpaths .. ok
 snap .. ok
 node .. ok
 unaryunion .. ok
 clean .. ok
 relate_bnr .. ok
 delaunaytriangles .. ok
 interrupt .. ok
 interrupt_relate .. ok
 interrupt_buffer .. ok
 clipbybox2d .. ok
 subdivide .. ok
 voronoi .. ok
 minimum_clearance .. ok
 in_geojson .. ok
 regress_brin_index .. ok
 regress_brin_index_3d .. ok
 regress_brin_index_geography .. ok
 mvt .. ok
 geobuf .. ok
 mvt_jsonb .. ok
 regress_sfcgal .. ok
 sfcgal/empty .. ok
 sfcgal/geography .. ok
 sfcgal/legacy .. ok
 sfcgal/measures .. ok
 sfcgal/regress_ogc_prep .. ok
 sfcgal/regress_ogc .. ok
 sfcgal/regress .. ok
 sfcgal/tickets .. ok
 sfcgal/concave_hull .. ok
 sfcgal/wmsservers .. ok
 sfcgal/approximatemedialaxis .. ok
 uninstall .. ok (4662)

Run tests: 135
Failed: 1

@pramsey,

I'm leaving this open because not sure I made the right changes. I was following the pattern of other code I saw in PostgreSQL 10.

In particular, I'm not sure about the flags. I had originally

 ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS

as I saw that in src/backend/tsearch/ts_selfuncs.c (tsvector estimates), but had to take out the ATTSTATSSLOT_VALUES since it was causing regression failure on regress_index and some others.

A lot of the other sample code in PostgreSQL land has this check like this:

if (HeapTupleIsValid(vardata->statsTuple))

I didn't bother with that and not sure if its relevant for us to check.

comment:4 by pramsey, 8 years ago

Your API fix looks fine. The regression failure seems to be related to changes in the test data. The initial failed lines actually indicate the test table has a different number of rows in it that we expect it to.

-selectivity_00|2127
-selectivity_01|1068
+selectivity_00|715
+selectivity_01|245

comment:5 by pramsey, 8 years ago

I've alerted -hackers, it looks like the behavour of generate_series changed in relation to the CTE construction we use to fill in the table that drives these tests.

comment:6 by pramsey, 8 years ago

Resolution: fixed
Status: newclosed

The change in generate_series was deliberate: https://www.postgresql.org/message-id/2634.1495646891%40sss.pgh.pa.us

I just fixed the regression test to use static data instead of dynamically generated in r15401

comment:7 by robe, 8 years ago

thanks now I can add 10 to our battery of testing.

Note: See TracTickets for help on using tickets.