Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Custom Processors] on coflict update #214

Open
keyliaran opened this issue Dec 8, 2023 · 0 comments
Open

[Custom Processors] on coflict update #214

keyliaran opened this issue Dec 8, 2023 · 0 comments
Labels
custom-processors Issues relating to the Custom Processors

Comments

@keyliaran
Copy link
Contributor

keyliaran commented Dec 8, 2023

Description

fun insert_current_coin_balances (https://github.com/aptos-labs/aptos-indexer-processors/blob/main/rust/processor/src/processors/coin_processor.rs#L216). If two+ records with the same owner_address, coin_type_hash will be in one chunk, then insertion will be impossible (ON CONFLICT DO UPDATE).

Repro

INSERT INTO current_coin_balances (owner_address, coin_type_hash, coin_type,
                          amount, last_transaction_version, last_transaction_timestamp)
VALUES
    ('0x1', '0x1', 'test', 1, 1, now()),
    ('0x1', '0x1', 'test', 1, 2, now())
ON CONFLICT (owner_address, coin_type_hash) DO UPDATE
    SET
        amount = excluded.amount,
        last_transaction_version = excluded.last_transaction_version
WHERE current_coin_balances.last_transaction_version <= excluded.last_transaction_version;
@keyliaran keyliaran added the custom-processors Issues relating to the Custom Processors label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
custom-processors Issues relating to the Custom Processors
Projects
None yet
Development

No branches or pull requests

1 participant