Return postgis version in diagnostics info (WIP)

This commit is contained in:
Rafa de la Torre 2019-11-08 19:49:16 +01:00
parent 8730292097
commit d4bc69cd3c
3 changed files with 23 additions and 2 deletions

View File

@ -41,6 +41,17 @@ $$
LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE;
CREATE OR REPLACE FUNCTION @extschema@.__CDB_FS_Foreign_PostGIS_Version_PG(server_internal name)
RETURNS text
AS $$
BEGIN
-- TODO implement
RETURN '4.0';
END
$$
LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE;
--
-- Collect and return diagnostics info from a remote PG into a jsonb
--
@ -49,8 +60,12 @@ RETURNS jsonb
AS $$
DECLARE
remote_server_version text := @extschema@.__CDB_FS_Foreign_Server_Version_PG(server_internal);
remote_postgis_version text := @extschema@.__CDB_FS_Foreign_PostGIS_Version_PG(server_internal);
BEGIN
RETURN jsonb_build_object('server_version', remote_server_version);
RETURN jsonb_build_object(
'server_version', remote_server_version,
'postgis_version', remote_postgis_version
);
END
$$
LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE;

View File

@ -38,6 +38,10 @@ SELECT '1.2', pg_typeof(cartodb.CDB_Federated_Server_Diagnostics(server => 'loop
SELECT '1.3', cartodb.CDB_Federated_Server_Diagnostics(server => 'loopback') @> format('{"server_version": "%s"}', setting)::jsonb
FROM pg_settings WHERE name = 'server_version';
\echo '%% It returns the postgis version'
SELECT '1.4', cartodb.CDB_Federated_Server_Diagnostics(server => 'loopback') @> format('{"postgis_version": "%s"}', extversion)::jsonb
FROM pg_extension WHERE extname = 'postgis';
-- ===================================================================
-- Cleanup

View File

@ -5,4 +5,6 @@ ERROR: Server "doesNotExist" does not exist
1.2|jsonb
%% It returns the server version
1.3|t
%% It returns the postgis version
1.4|t
D1|