Skip to content

Conversation

ncruces
Copy link
Contributor

@ncruces ncruces commented Jun 6, 2023

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Documentation for database/sql.Scanner states that Scan(src) should not retain (i.e. it should copy) the src argument.

// Reference types such as []byte are only valid until the next call to Scan
// and should not be retained. Their underlying memory is owned by the driver.
// If retention is necessary, copy their values before the next call to Scan.

This becomes an issue for this test if a driver returns a slice that is invalidated by rows.Close().

User Case Description

Copying the slice fixes this test failing with my SQLite driver.

@jinzhu jinzhu merged commit 7157b7e into go-gorm:master Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants