Opened 22 months ago

Last modified 22 months ago

#5309 reopened defect

ST_ClusterKMeans not working on PostGIS 3.23

Reported by: jbtw Owned by: pramsey
Priority: medium Milestone:
Component: postgis Version: 3.2.x
Keywords: Cc:

Description

Hello,

It seems to me that ST_ClusterKMeans is not working on PostGIS 3.23. I noticed that some queries including a clustering step were failing and locally even the example from the ST_ClusterKMeans documentation page fails with an abrupt termination.

CREATE TABLE parcels AS
SELECT lpad((row_number() over())::text,3,'0') As parcel_id, geom,
('{residential, commercial}'::text[])[1 + mod(row_number()OVER(),2)] As type
FROM
    ST_Subdivide(ST_Buffer('SRID=3857;LINESTRING(40 100, 98 100, 100 150, 60 90)'::geometry,
    40, 'endcap=square'),12) As geom;

SELECT ST_ClusterKMeans(geom, 3) OVER() AS cid, parcel_id, geom
    FROM parcels;

Termination Message:

psql:test.sql:10: server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
psql:test.sql:10: fatal: connection to server was lost

PostGIS Full version output:

POSTGIS="3.2.3 v2.4.3-242-g8556d9e" [EXTENSION] PGSQL="140" GEOS="3.10.3-CAPI-1.16.1" PROJ="8.1.1" LIBXML="2.9.14" LIBJSON="0.15" LIBPROTOBUF="1.4.1" WAGYU="0.5.0 (Internal)" (core procs from "3.1.4 v2.4.3-44-g7ef659a"

Change History (2)

comment:1 by komzpa, 22 months ago

Resolution: worksforme
Status: newclosed

Hello,

I cannot reproduce this on my PostGIS 3.3.2. Your PostGIS full version output suggests there is a problem with how you upgraded the system, mixing up 3.2.3, 2.4.3, and 3.1.4 at the same time. Please run SELECT postgis_extensions_upgrade(); in all of your databases and try again, until postgis_full_version() does not show the discrepancy of core procs version and the library version. Also consider upgrading to the 3.3 branch. If problem persists, please reopen this ticket with new details.

comment:2 by jbtw, 22 months ago

Resolution: worksforme
Status: closedreopened

Hello,

I confirmed on my local machine that upgrading PostGIS fixes the problem. Originally I encountered the problem on a managed Postgres Instance (and still see it there) on the Azure Cloud. I don't have the ability to manually upgrade there however. The postgis_full_version on that instance is

POSTGIS="3.2.3 0" [EXTENSION] PGSQL="130" GEOS="3.9.2-CAPI-1.14.3" PROJ="9.0.1" LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)" (core procs from "3.1.1 aaf4c79" need upgrade)

If doesn't have the conflicting versions my local installation had but if it's still a configuration problem, then I can take it up with someone from Azure (and point them to this ticket).

Note: See TracTickets for help on using tickets.