Skip to content

Commit

Permalink
fix: postgres timestamp casting should include timezone
Browse files Browse the repository at this point in the history
Signed-off-by: Clément Salaün <[email protected]>
  • Loading branch information
altitude committed Feb 5, 2024
1 parent 010ab3b commit 905dfcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/storage/sqlstorage/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func (s *Store) insertTransactions(ctx context.Context, txs ...core.ExpandedTran
pre_commit_volumes,
post_commit_volumes) (SELECT * FROM unnest(
$1::int[],
$2::timestamp[],
$2::timestamptz[],
$3::varchar[],
$4::jsonb[],
$5::jsonb[],
Expand Down
3 changes: 3 additions & 0 deletions pkg/storage/sqlstorage/transactions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ func testTransactions(t *testing.T, store *sqlstorage.Store) {
// Should get only the first transaction.
require.Equal(t, 1, cursor.PageSize)

// Transaction timestamp fetched should be equal to the timestamp of the committed transaction.
require.Equal(t, cursor.Data[0].Timestamp, tx3.Timestamp.Format(time.RFC3339))

cursor, err = store.GetTransactions(context.Background(), ledger.TransactionsQuery{
AfterTxID: cursor.Data[0].ID,
PageSize: 1,
Expand Down

0 comments on commit 905dfcd

Please sign in to comment.