Skip to content

Commit

Permalink
Add NULL condition check on asset.seq
Browse files Browse the repository at this point in the history
  • Loading branch information
danenbm committed Dec 13, 2023
1 parent fa0839d commit 4b96e97
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nft_ingester/src/program_transformers/bubblegum/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ where
// Do not overwrite changes that happened after decompression (asset.seq = 0).
// Do not overwrite changes from a later Bubblegum instruction.
query.sql = format!(
"{} WHERE asset.seq != 0 AND (excluded.leaf_seq >= asset.leaf_seq OR asset.leaf_seq IS NULL)",
"{} WHERE (asset.seq != 0 OR asset.seq IS NULL) AND (excluded.leaf_seq >= asset.leaf_seq OR asset.leaf_seq IS NULL)",
query.sql
);

Expand Down Expand Up @@ -238,7 +238,7 @@ where
.build(DbBackend::Postgres);

// Do not overwrite changes that happened after decompression (asset.seq = 0).
query.sql = format!("{} WHERE asset.seq != 0", query.sql);
query.sql = format!("{} WHERE asset.seq != 0 OR asset.seq IS NULL", query.sql);

txn.execute(query)
.await
Expand Down Expand Up @@ -280,7 +280,7 @@ where
// Do not overwrite changes that happened after decompression (asset.seq = 0).
// Do not overwrite changes from a later Bubblegum instruction.
query.sql = format!(
"{} WHERE asset.seq != 0 AND (excluded.owner_delegate_seq >= asset.owner_delegate_seq OR asset.owner_delegate_seq IS NULL)",
"{} WHERE (asset.seq != 0 OR asset.seq IS NULL) AND (excluded.owner_delegate_seq >= asset.owner_delegate_seq OR asset.owner_delegate_seq IS NULL)",
query.sql
);

Expand Down Expand Up @@ -325,7 +325,7 @@ where
.build(DbBackend::Postgres);

// Do not overwrite changes that happened after decompression (asset.seq = 0).
query.sql = format!("{} WHERE asset.seq != 0", query.sql);
query.sql = format!("{} WHERE asset.seq != 0 OR asset.seq IS NULL", query.sql);
txn.execute(query).await?;

Ok(())
Expand Down Expand Up @@ -637,7 +637,7 @@ where
)
.build(DbBackend::Postgres);
query.sql = format!(
"{} WHERE asset.seq != 0 AND (excluded.base_info_seq >= asset.base_info_seq OR asset.base_info_seq IS NULL)",
"{} WHERE (asset.seq != 0 OR asset.seq IS NULL) AND (excluded.base_info_seq >= asset.base_info_seq OR asset.base_info_seq IS NULL)",
query.sql
);

Expand Down

0 comments on commit 4b96e97

Please sign in to comment.