From 66cfcca1cb1ad262731d08e41badcfe90680a93d Mon Sep 17 00:00:00 2001 From: alexfca <75228224+alexfca@users.noreply.github.com> Date: Mon, 8 Nov 2021 11:24:02 +1100 Subject: [PATCH] Fix the typo in the SQL (#26) * - Ensure the correct ID is returned from the Max statements as the NullInt64 was not working as expected - Check before creating the nextAccountDataID * - Set the pos output var correctly and fix typo in the SQL Co-authored-by: alexf@example.com --- syncapi/storage/cosmosdb/account_data_table.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syncapi/storage/cosmosdb/account_data_table.go b/syncapi/storage/cosmosdb/account_data_table.go index 55fffdd42..7db4fa7fe 100644 --- a/syncapi/storage/cosmosdb/account_data_table.go +++ b/syncapi/storage/cosmosdb/account_data_table.go @@ -67,7 +67,7 @@ const selectAccountDataInRangeSQL = "" + "select * from c where c._cn = @x1 " + "and c.mx_syncapi_account_data_type.user_id = @x2 " + "and c.mx_syncapi_account_data_type.id > @x3 " + - "and c.mx_syncapi_account_data_type.id < @x4 " + + "and c.mx_syncapi_account_data_type.id <= @x4 " + "order by c.mx_syncapi_account_data_type.id " // "SELECT MAX(id) FROM syncapi_account_data_type" @@ -137,6 +137,7 @@ func (s *accountDataStatements) InsertAccountData( dbData, _ := getAccountDataType(s, ctx, s.getPartitionKey(), cosmosDocId) if dbData != nil { + pos = types.StreamPosition(dbData.AccountDataType.ID) dbData.SetUpdateTime() } else { pos, err = s.streamIDStatements.nextAccountDataID(ctx, txn)