def _update_query(table: str, field: str, is_jsonb: bool, from_string: str,
                  to_string: str) -> str:
    """Generates a single query to update a field in a PostgresSQL table.

    Args:
        table (str): The table to update.
        field (str): The field to update.
        is_jsonb (bool): Whether the field is jsonb or not.
        from_string (str): The string to replace.
        to_string (str): The string to replace with.

    Returns:
        str: The query to update the field.

    """
    const = f'UPDATE {table} SET "{field}" = replace({field}'  # noqa
    if is_jsonb:
        query = f'{const}::TEXT, \'{from_string}\', \'{to_string}\')::jsonb;'
    else:
        query = f'{const}, \'{from_string}\', \'{to_string}\');'
    return query