From 528574c5508b3359bd1637b22314ba830b43cc98 Mon Sep 17 00:00:00 2001 From: Javier Goizueta Date: Wed, 20 Jan 2016 17:10:12 +0100 Subject: [PATCH] Add dummy CDB_Overviews SQL function for tests --- test/support/prepare_db.sh | 2 +- test/support/sql/CDB_Overviews.sql | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 test/support/sql/CDB_Overviews.sql diff --git a/test/support/prepare_db.sh b/test/support/prepare_db.sh index ab9149a2..acc496ed 100755 --- a/test/support/prepare_db.sh +++ b/test/support/prepare_db.sh @@ -81,7 +81,7 @@ if test x"$PREPARE_PGSQL" = xyes; then psql -c "CREATE LANGUAGE plpythonu;" ${TEST_DB} curl -L -s https://github.com/CartoDB/cartodb-postgresql/raw/cdb/scripts-available/CDB_QueryStatements.sql -o sql/CDB_QueryStatements.sql curl -L -s https://github.com/CartoDB/cartodb-postgresql/raw/cdb/scripts-available/CDB_QueryTables.sql -o sql/CDB_QueryTables.sql - cat sql/CDB_QueryStatements.sql sql/CDB_QueryTables.sql | + cat sql/CDB_QueryStatements.sql sql/CDB_QueryTables.sql sql/CDB_Overviews.sql | psql -v ON_ERROR_STOP=1 ${TEST_DB} || exit 1 fi diff --git a/test/support/sql/CDB_Overviews.sql b/test/support/sql/CDB_Overviews.sql new file mode 100644 index 00000000..c093dfa9 --- /dev/null +++ b/test/support/sql/CDB_Overviews.sql @@ -0,0 +1,15 @@ +-- Mockup for CDB_Overviews +CREATE OR REPLACE FUNCTION CDB_Overviews(table_name text) +RETURNS TABLE(z integer, overview_table text) +AS $$ + BEGIN + IF table_name = 'test_table_overviews' THEN + RETURN QUERY + SELECT 1 AS z, 'test_table_overviews_ov1'::text AS overviw_table + UNION ALL + SELECT 2 AS z, 'test_table_overviews_ov2'::text AS overviw_table; + ELSE + RETURN; + END IF; + END +$$ LANGUAGE PLPGSQL;