def METHOD_NAME(self):
    self.env.cr.execute(
        """
        SELECT name, installed_version
        FROM pg_available_extensions
        WHERE name = 'pg_trgm'
        LIMIT 1;
        """
    )
    extension = self.env.cr.fetchone()
    if extension is None:
        return "missing"
    if extension[1] is None:
        return "uninstalled"
    return "installed"