Opened 13 years ago

Closed 10 years ago

#510 closed defect (wontfix)

ST_Estimated_Extent doesn't work with views

Reported by: Mike Taves Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.2
Component: postgis Version: 1.5.X
Keywords: Cc:


If a GIS-enabled view is set up with metadata in the geometry_columns table, the ST_Estimated_Extent command throws an error:

select st_estimated_extent('public','myview','the_geom');
ERROR: LWGEOM_estimated_extent: couldn't locate table within current schema
SQL state: XX000

even though the relation exists:

SELECT count(*)=1
FROM pg_catalog.pg_namespace nm
JOIN pg_catalog.pg_class c ON nm.oid=c.relnamespace
JOIN pg_catalog.pg_attribute a ON c.oid=a.attrelid
WHERE nm.nspname='public' AND c.relname='myview' AND attname='the_geom'

This error appears to affect the FDO PostGIS Provider, since I see this error in the logs near crashes in AutoCAD Map 3D.

Change History (4)

comment:1 by Mike Taves, 13 years ago

As a workaround for FDO users that use the PostGIS Provider, you can try replacing one of the functions:

CREATE OR REPLACE FUNCTION estimated_extent(text, text, text)
  RETURNS box2d AS
  res box2d;
  EXECUTE 'select st_extent(' || quote_ident($3) || ') from ' || quote_ident($1) || '.' || quote_ident($2) INTO res;
  RETURN res;
  COST 1;

This workaround has made AutoCAD Map3D 2008 and 2010 more stable (fewer crashes) when loading layers and generally working with the FDO PostGIS Provider.

comment:2 by robe, 12 years ago

Milestone: PostGIS 1.5.3PostGIS 1.5.4

comment:3 by robe, 11 years ago

Milestone: PostGIS 1.5.4PostGIS 2.0.2

comment:4 by strk, 10 years ago

Resolution: wontfix
Status: newclosed

ST_EstimtedExtent only works with real tables, for which stats exist. Estimating the extent of a query would be pretty wild guess.

Note: See TracTickets for help on using tickets.