]> granicus.if.org Git - postgis/commitdiff
Drop dependency of estimation test on XML type (#2151)
authorSandro Santilli <strk@keybit.net>
Tue, 22 Jul 2014 08:52:01 +0000 (08:52 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 22 Jul 2014 08:52:01 +0000 (08:52 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@12816 b70326c6-7e19-0410-871a-916f4a2858ee

regress/regress_index.sql

index e0d3e01385afbf80b7f43f9f298a96b4b343f487..c637541d6e658a08855f02bdc7dc8f515e2651ac 100644 (file)
@@ -17,23 +17,20 @@ CREATE FUNCTION estimate_error(qry text, tol int)
 RETURNS text
 LANGUAGE 'plpgsql' VOLATILE AS $$
 DECLARE
-  anl XML; -- analisys
+  anl TEXT; -- analisys
   err INT; -- absolute difference between planned and actual rows
   est INT; -- estimated count
   act INT; -- actual count
+  mat TEXT[];
 BEGIN
-  EXECUTE 'EXPLAIN (ANALYZE, FORMAT XML) ' || qry INTO STRICT anl;
+  EXECUTE 'EXPLAIN ANALYZE ' || qry INTO anl;
 
-  SELECT (xpath('//x:Plan-Rows/text()', anl,
-         ARRAY[ARRAY['x', 'http://www.postgresql.org/2009/explain']]))[1]
-         ::text::int
-  INTO est;
-
-  SELECT (xpath('//x:Actual-Rows/text()', anl,
-         ARRAY[ARRAY['x', 'http://www.postgresql.org/2009/explain']]))[1]
-         ::text::int
-  INTO act;
+  SELECT regexp_matches(anl, ' rows=([0-9]*) .* rows=([0-9]*) ')
+  INTO mat;
 
+  est := mat[1];
+  act := mat[2];
+    
   err = abs(est-act);
 
   RETURN act || '+=' || tol || ':' || coalesce(