Adapt to changes in CDB_Overviews SQL function

Now data for multiple tables is obtained in one call, simplifying the
use of this function. Also base table is returned as an oid, so we
now have the overview base table names with schema only when needed.
This commit is contained in:
Javier Goizueta
2016-01-26 11:38:21 +01:00
parent 2a819e559b
commit ef9e9f8c78
6 changed files with 61 additions and 77 deletions

View File

@@ -1,13 +1,13 @@
-- Mockup for CDB_Overviews
CREATE OR REPLACE FUNCTION CDB_Overviews(table_name regclass)
RETURNS TABLE(z integer, overview_table regclass)
CREATE OR REPLACE FUNCTION CDB_Overviews(table_names regclass[])
RETURNS TABLE(base_table regclass, z integer, overview_table regclass)
AS $$
BEGIN
IF table_name::text = 'test_table_overviews' THEN
IF (SELECT 'test_table_overviews'::regclass = ANY (table_names)) THEN
RETURN QUERY
SELECT 1 AS z, 'test_table_overviews_ov1'::regclass AS overviw_table
SELECT 'test_table_overviews'::regclass AS base_table, 1 AS z, 'test_table_overviews_ov1'::regclass AS overviw_table
UNION ALL
SELECT 2 AS z, 'test_table_overviews_ov2'::regclass AS overviw_table;
SELECT 'test_table_overviews'::regclass AS base_table, 2 AS z, 'test_table_overviews_ov2'::regclass AS overviw_table;
ELSE
RETURN;
END IF;