Permission tests and fixes for CDB_FederatedServerListRemote

This commit is contained in:
Raul Marin
2019-11-05 14:35:52 +01:00
parent bac7d79ab3
commit aa481f4219
4 changed files with 297 additions and 42 deletions

View File

@@ -34,11 +34,16 @@ BEGIN
END IF;
-- Return the result we're interested in. Exclude toast and temp schemas
RETURN QUERY EXECUTE format('
SELECT schema_name::name AS remote_schema FROM %I.%I
WHERE schema_name NOT LIKE %s
ORDER BY remote_schema
', local_schema, remote_table, '''pg_%''');
BEGIN
RETURN QUERY EXECUTE format('
SELECT schema_name::name AS remote_schema FROM %I.%I
WHERE schema_name NOT LIKE %s
ORDER BY remote_schema
', local_schema, remote_table, '''pg_%''');
EXCEPTION WHEN OTHERS THEN
RAISE EXCEPTION 'Not enough permissions to access the server "%": %',
@extschema@.__CDB_FS_Extract_Server_Name(server_internal), SQLERRM;
END;
END
$$
LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE;