From 4100b66f3bddf4ccadf2525296abb3c3c92fc3d1 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Fri, 8 Nov 2019 15:25:57 +0100 Subject: [PATCH] Scaffolding for diagnostic function(s) --- scripts-available/CDB_FederatedServerDiagnostics.sql | 12 ++++++++++++ .../403-CDB_FederatedServerDiagnostics.sql | 1 + test/CDB_FederatedServerDiagnostics.sql | 2 ++ test/CDB_FederatedServerDiagnostics_expect | 2 ++ 4 files changed, 17 insertions(+) create mode 100644 scripts-available/CDB_FederatedServerDiagnostics.sql create mode 120000 scripts-enabled/403-CDB_FederatedServerDiagnostics.sql create mode 100644 test/CDB_FederatedServerDiagnostics.sql create mode 100644 test/CDB_FederatedServerDiagnostics_expect diff --git a/scripts-available/CDB_FederatedServerDiagnostics.sql b/scripts-available/CDB_FederatedServerDiagnostics.sql new file mode 100644 index 0000000..7b16263 --- /dev/null +++ b/scripts-available/CDB_FederatedServerDiagnostics.sql @@ -0,0 +1,12 @@ +-------------------------------------------------------------------------------- +-- Public functions +-------------------------------------------------------------------------------- + +CREATE OR REPLACE FUNCTION @extschema@.CDB_Federated_Server_Diagnostics(server TEXT) +RETURNS json -- TODO decide if json or jsonb +AS $$ +BEGIN + RETURN '{}'::json; +END +$$ +LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE; diff --git a/scripts-enabled/403-CDB_FederatedServerDiagnostics.sql b/scripts-enabled/403-CDB_FederatedServerDiagnostics.sql new file mode 120000 index 0000000..edab4d4 --- /dev/null +++ b/scripts-enabled/403-CDB_FederatedServerDiagnostics.sql @@ -0,0 +1 @@ +../scripts-available/CDB_FederatedServerDiagnostics.sql \ No newline at end of file diff --git a/test/CDB_FederatedServerDiagnostics.sql b/test/CDB_FederatedServerDiagnostics.sql new file mode 100644 index 0000000..d0af580 --- /dev/null +++ b/test/CDB_FederatedServerDiagnostics.sql @@ -0,0 +1,2 @@ +\echo '%% It raises an error if the server does not exist' +SELECT '1.1', cartodb.CDB_Federated_Server_Diagnostics(server => 'doesNotExist'); diff --git a/test/CDB_FederatedServerDiagnostics_expect b/test/CDB_FederatedServerDiagnostics_expect new file mode 100644 index 0000000..ea8ac49 --- /dev/null +++ b/test/CDB_FederatedServerDiagnostics_expect @@ -0,0 +1,2 @@ +%% It raises an error if the server does not exist +1.1|{}