Skip to content

Commit 99c8264

Browse files
committed
better null checking in postgres
fixes #237
1 parent 0663ad8 commit 99c8264

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Delta/DeltaExtensions_Sql.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,16 @@ select log_end_lsn from sys.dm_db_log_stats(db_id())
6565
select pg_last_committed_xact();
6666
-- end-snippet
6767
""";
68-
var result = (object[]?) await command.ExecuteScalarAsync(cancel);
68+
var results = (object?[]?) await command.ExecuteScalarAsync(cancel);
69+
6970
// null on first run after SET track_commit_timestamp to 'on'
71+
var result = results?[0];
7072
if (result is null)
7173
{
7274
return string.Empty;
7375
}
7476

75-
var xid = (uint) result[0];
77+
var xid = (uint) result;
7678
return xid.ToString();
7779
}
7880

0 commit comments

Comments
 (0)