Postgres cannot find distance function for gist index

Viewed 147

I have a query like so:

SELECT * FROM mytable
ORDER BY geo_coords <-> ST_MakePoint(<some_lon>, <some_lat>)

The geo_coords column on mytable is a GEOGRAPHY type and I have a GIST index, called myindex, on that column.

When I run this query on enough records for the query planner to use the index, I get the following error:

org.postgresql.util.PSQLException: ERROR: missing support function 8 for attribute 1 of index "myindex"

I believe this means that postgres can't find the distance support function, but I am not sure how this is possible.

The GIST support function table shows that function #8 is the distance function

Why wouldn't postgres be able to find the distance function? I am not sure how to further debug this.

Postgres Version:

PostgreSQL 12.6 on aarch64-unknown-linux-gnu, compiled by gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), 64-bit

Postgis Version:

POSTGIS="3.0.2 2fb2a18" [EXTENSION] PGSQL="120" GEOS="3.8.0-CAPI-1.13.1 " PROJ="Rel. 5.2.0, September 15th, 2018" GDAL="GDAL 2.4.4, released 2020/01/08" LIBXML="2.9.1" LIBJSON="0.13.1" LIBPROTOBUF="1.3.2" WAGYU="0.4.3 (Internal)" RASTER (raster procs from "3.0.0 r17983" need upgrade)
1 Answers

Since you are running 3.0.2, it should not be this bug which was fixed with this commit in version 3.0.1 (see the release notes).

This is a PostGIS bug, and you should report it.

Once there is a fix, you will need to upgrade. There is no way to get rid of bugs without upgrading.

Related