Skip to content

Commit

Permalink
add test for old code can't scan to uuid type
Browse files Browse the repository at this point in the history
  • Loading branch information
rekby committed Oct 17, 2024
1 parent c3bd121 commit 29f6adb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/integration/database_sql_regression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,28 @@ SELECT CAST($val AS UUID)`,
err := row.Scan(&res)
require.Error(t, err)
})
t.Run("old-receive-to-uuid", func(t *testing.T) {
// test old behavior - for test way of safe work with data, written with bagged API version
var (
scope = newScope(t)
db = scope.SQLDriver()
)

idString := "6E73B41C-4EDE-4D08-9CFB-B7462D9E498B"
row := db.QueryRow(`
DECLARE $val AS Text;
SELECT CAST($val AS UUID)`,
sql.Named("val", idString),
)

require.NoError(t, row.Err())

var res uuid.UUID

err := row.Scan(&res)
require.Error(t, err)
})
t.Run("old-send-receive", func(t *testing.T) {
// test old behavior - for test way of safe work with data, written with bagged API version
var (
Expand Down

0 comments on commit 29f6adb

Please sign in to comment.