<commit_before>DROP FUNCTION IF EXISTS compare_server_client_case_transaction_order(TEXT);

CREATE FUNCTION compare_server_client_case_transaction_order(
    _case_id TEXT
) RETURNS BOOLEAN AS $$
BEGIN
    RETURN (
        WITH transaction_orders AS (
            SELECT
                ROW_NUMBER() OVER (ORDER BY server_date) ordinal_by_server_date,
                ROW_NUMBER() OVER (ORDER BY client_date) ordinal_by_client_date
            FROM form_processor_casetransaction
            WHERE case_id = _case_id
        )
        SELECT NOT EXISTS (
            SELECT *
            FROM transaction_orders
            WHERE ordinal_by_server_date != ordinal_by_client_date
        )
    );
END;
$$ LANGUAGE plpgsql;<commit_msg>require dates to exist<commit_after>DROP FUNCTION IF EXISTS compare_server_client_case_transaction_order(TEXT);

CREATE FUNCTION compare_server_client_case_transaction_order(
    _case_id TEXT
) RETURNS BOOLEAN AS $$
BEGIN
    RETURN (
        WITH transaction_orders AS (
            SELECT ROW_NUMBER() OVER (ORDER BY server_date) ordinal_by_server_date,
                   ROW_NUMBER() OVER (ORDER BY client_date) ordinal_by_client_date
            FROM form_processor_casetransaction
            WHERE case_id = _case_id
                  AND client_date IS NOT NULL
                  AND server_date IS NOT NULL
        )
        SELECT NOT EXISTS (
            SELECT *
            FROM transaction_orders
            WHERE ordinal_by_server_date != ordinal_by_client_date
        )
    );
END;
$$ LANGUAGE plpgsql;
{'fraction_non_alphanumeric': 0.043758043758043756, 'fraction_numerical': 0.0, 'mean_word_length': 2.432671081677704, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4233979', 'n_tokens_mistral': 463, 'n_tokens_neox': 427, 'n_words': 108}