[postgis-devel] Issue 72 in postgis: ST_Estimated_Extent sometimes returns null if table exists but not in current schema

codesite-noreply at google.com codesite-noreply at google.com
Mon Nov 24 11:48:31 PST 2008


Comment #4 on issue 72 by robe.... at cityofboston.gov: ST_Estimated_Extent  
sometimes returns null if table exists but not in current schema
http://code.google.com/p/postgis/issues/detail?id=72

I'm sure Paul is probably grunting profusely at this point and wishing he  
released
while you were on vacation.  So you mean something like this?

CREATE OR REPLACE FUNCTION st_estimated_extent(param_table_name  
text,param_geom_name
text)
   RETURNS box2d AS
   $$
DECLARE var_schema text;
BEGIN
	SELECT n.nspname AS schemaname
	INTO var_schema
	FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid =
	c.relnamespace
	WHERE c.relkind IN ('r','')
	AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
	 AND pg_catalog.pg_table_is_visible(c.oid)
	AND c.relname = quote_ident(param_table_name);
	
	IF FOUND THEN
		RETURN st_estimated_extent(var_schema, param_table_name, param_geom_name);
	ELSE
		RAISE EXCEPTION 'Table % is not visible.', param_table_name ;
	END IF;
END;
$$
   LANGUAGE 'plpgsql' IMMUTABLE STRICT SECURITY DEFINER;

-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings



More information about the postgis-devel mailing list