Opened 4 years ago
Last modified 4 years ago
#4695 closed defect
ERROR: GetGenericCacheCollection: Could not find upper context ST_AsGeoJSON and pg13 — at Version 4
Reported by: | robe | Owned by: | pramsey |
---|---|---|---|
Priority: | blocker | Milestone: | PostGIS 3.1.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description (last modified by )
I'm running this query on PostGIS 3.1.0dev
POSTGIS="3.1.0dev 3.1.0alpha1-122-g16121bf79" [EXTENSION] PGSQL="130" GEOS="3.9.0-CAPI-1.14.0" PROJ="6.2.1" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)"
and on PostgreSQL 13beta1 (headish).
Steps to replicate the issue:
CREATE TABLE test AS SELECT row_number()OVER() AS id, 'test' || i::text || j::text AS name, ST_SetSRID(ST_Point(i,j),2227) AS geom FROM generate_series(1,10) AS i, generate_series(5,10,2) AS j; SELECT ST_ASGeoJSON(c) FROM test AS c;
Yields error:
ERROR: GetGenericCacheCollection: Could not find upper context SQL state: XX000
This same query seems to work fine on PostgreSQL 12 with PostGIS 3.1.0. I haven't tested with PostGIS 3.0 and 13 yet but assume it has the same issue.
I'm guessing it has to do with the interaction of spatial_ref_sys, since this works fine:
CREATE TABLE test2 AS SELECT row_number()OVER() AS id, 'test' || i::text || j::text AS name, ST_Point(i,j) AS geom FROM generate_series(1,10) AS i, generate_series(5,10,2) AS j; SELECT ST_ASGeoJSON(c) FROM test2 AS c;
Change History (4)
comment:1 by , 4 years ago
Description: | modified (diff) |
---|
comment:2 by , 4 years ago
comment:3 by , 4 years ago
I'm not seeing the ST_AsGeoJSON call and I'm confused this works in PG12 but not in 13. If I had to guess I'd say the issue could be in https://github.com/postgis/postgis/blob/b48fb3e2272568aa6310fc26aefc69010d4f37e3/postgis/lwgeom_out_geojson.c#L170
I'll try to reproduce it and get more tests around it
comment:4 by , 4 years ago
Description: | modified (diff) |
---|
Sorry about that -- I completely forgot to include the actual code :) so focused on creating test data.
FWIW might be related to #4674 maybe similar thing going on here.