Skip to content

Conversation

@vinhloc30796
Copy link

@vinhloc30796 vinhloc30796 commented Aug 25, 2025

substreams_history will look like so:

substreams=> select * from substreams_history limit 1;
-[ RECORD 1 ]-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
id         | 75756
op         | I
table_name | "public"."subtransaction"
pk         | {"block_number":"34830163","chain_id":"8453","trace_index":"ARRAY[]::bigint[]","transaction_hash":"0xd24deec488102fe7356efb5c034545f8d9c945b8881764c8b7f70a62a3c9d2a4"}
prev_value | 
block_num  | 34830163

Comment on lines +358 to +361
whereClause, err := d.getPrimaryKeyWhereClauseTyped(table, primaryKey, "")
if err != nil {
whereClause = getPrimaryKeyWhereClause(primaryKey, "")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a good way of doing it, can you add a comment explaining the reasoning here, we should also log the error minimally in DEBUG mode if it's expected to log a lot of time.

Comment on lines +327 to +329
if err != nil {
onClause = getPrimaryKeyWhereClause(primaryKey, table.nameEscaped)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, add comment as the why it's correct and log error.

Comment on lines +426 to +429
primaryKeySelector, err := d.getPrimaryKeyWhereClauseTyped(o.table, o.primaryKey, "")
if err != nil {
return "", err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this backward compatible? The question is essentially, if there is already substreams_history entries`, are they going to be read correctly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants