Stub function to add server_version to diagnostics

This commit is contained in:
Rafa de la Torre 2019-11-08 18:09:22 +01:00
parent 35b2b7e589
commit 40a2ba9569
3 changed files with 19 additions and 1 deletions

View File

@ -2,11 +2,24 @@
-- Private functions
--------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION @extschema@.__CDB_FS_Server_Version_PG(server_internal name)
RETURNS text
AS $$
BEGIN
-- TODO Implement
RETURN '14.0';
END
$$
LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE;
CREATE OR REPLACE FUNCTION @extschema@.__CDB_FS_Server_Diagnostics_PG(server_internal name)
RETURNS jsonb
AS $$
DECLARE
remote_server_version text := @extschema@.__CDB_FS_Server_Version_PG(server_internal);
BEGIN
RETURN '{}'::jsonb;
RETURN jsonb_build_object('server_version', remote_server_version);
END
$$
LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE;

View File

@ -34,6 +34,9 @@ SELECT '1.1', cartodb.CDB_Federated_Server_Diagnostics(server => 'doesNotExist')
\echo '%% It returns a jsonb object'
SELECT '1.2', pg_typeof(cartodb.CDB_Federated_Server_Diagnostics(server => 'loopback'));
\echo '%% It returns the server version'
SELECT '1.3', cartodb.CDB_Federated_Server_Diagnostics(server => 'loopback') @> '{"server_version": "14.0"}'::jsonb;
-- ===================================================================
-- Cleanup

View File

@ -3,4 +3,6 @@ C1|
ERROR: Server "doesNotExist" does not exist
%% It returns a jsonb object
1.2|jsonb
%% It returns the server version
1.3|t
D1|