-- REPORTE DETALLADO DE CONFIGURACIÓN FDW (Servidor .123)
SELECT '--- SERVIDORES EXTRANJEROS ---' as reporte;
SELECT srvname, srvfdw, srvoptions FROM pg_foreign_server;

SELECT '--- MAPEO DE USUARIOS ---' as reporte;
SELECT umuser::regrole as usuario_local, umoptions FROM pg_user_mapping;

SELECT '--- TABLAS FORÁNEAS EN fdw_505 ---' as reporte;
SELECT foreign_table_schema, foreign_table_name FROM information_schema.foreign_tables 
WHERE foreign_table_schema = 'fdw_505';

SELECT '--- DETALLE DE LA TABLA fdw_505.usuarios ---' as reporte;
SELECT column_name, data_type, is_nullable 
FROM information_schema.columns 
WHERE table_schema = 'fdw_505' AND table_name = 'usuarios'
ORDER BY ordinal_position;

SELECT '--- EXTENSIONES INSTALADAS ---' as reporte;
SELECT extname, extversion FROM pg_extension;
