From 2766bbc83adf693c23f75b6b8cae072ea12d8d5a Mon Sep 17 00:00:00 2001 From: Javier Goizueta Date: Wed, 18 Jul 2018 12:13:31 +0200 Subject: [PATCH] Fix PARALLEL tags Fixes #333 --- NEWS.md | 3 +++ scripts-available/CDB_EstimateRowCount.sql | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 0b26f55..124f4f1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +0.23.1 (yyyy-mm-dd) +* Fix `CDB_EstimateRowCount` parallelizability #333 + 0.23.0 (2018-07-03) * Add a new helper function `_CDB_Table_Exists(table_name_with_optional_schema TEXT)` #332 diff --git a/scripts-available/CDB_EstimateRowCount.sql b/scripts-available/CDB_EstimateRowCount.sql index 3b43014..d9cad80 100644 --- a/scripts-available/CDB_EstimateRowCount.sql +++ b/scripts-available/CDB_EstimateRowCount.sql @@ -12,7 +12,7 @@ BEGIN EXECUTE Format('ANALYZE %s;', reloid); END IF; END -$$ LANGUAGE 'plpgsql' VOLATILE STRICT PARALLEL RESTRICTED SECURITY DEFINER; +$$ LANGUAGE 'plpgsql' VOLATILE STRICT PARALLEL UNSAFE SECURITY DEFINER; -- Return a row count estimate of the result of a query using statistics CREATE OR REPLACE FUNCTION CDB_EstimateRowCount(query text) @@ -28,4 +28,4 @@ BEGIN EXECUTE 'EXPLAIN (FORMAT JSON) ' || query INTO STRICT plan; RETURN plan->0->'Plan'->'Plan Rows'; END -$$ LANGUAGE 'plpgsql' VOLATILE STRICT PARALLEL RESTRICTED; +$$ LANGUAGE 'plpgsql' VOLATILE STRICT PARALLEL UNSAFE;