
  SELECT EXISTS (
    SELECT 1
    FROM pg_catalog.pg_foreign_server srv
    INNER JOIN pg_catalog.pg_foreign_data_wrapper fdw ON (srvfdw = fdw.oid)
    WHERE srv.oid = $1
    AND (fdw.fdwname LIKE '%_dblink' OR fdw.fdwname = 'postgres_fdw')
    AND srvname !~ '_priv([[:digit:]]+)$'
  );
