pgx icon indicating copy to clipboard operation
pgx copied to clipboard

can't scan into dest[77]: type assertion to []byte failed

Open junioryono opened this issue 10 months ago • 1 comments

Describe the bug can't scan into dest[77]: type assertion to []byte failed

To Reproduce

func (s *matchParticipantsService) GetByGameIDsAndRegion(gameIDs []int64, rgn region.Region) ([]models.LeagueOfLegendsMatchParticipant, error) {
	query := `SELECT * FROM lol_match_participants WHERE game_id = ANY($1::bigint[]) AND region = $2`

	rows, err := s.pgxPool.Query(s.ctx, query, gameIDs, rgn)
	if err != nil {
		return nil, err
	}
	defer rows.Close()

	return pgx.CollectRows(rows, pgx.RowToStructByName[models.LeagueOfLegendsMatchParticipant])
}

I cannot provide the LeagueOfLegendsMatchParticipant type.

Expected behavior pgx should successfully scan results

Actual behavior can't scan into dest[77]: type assertion to []byte failed

Version

  • Go: go version go1.23.3 windows/amd64
  • PostgreSQL: 17.2
  • pgx: github.com/jackc/pgx/v5 v5.7.2

The error does not occur when using github.com/jackc/pgx/v5 v5.7.1

junioryono avatar Jan 21 '25 05:01 junioryono

Try master. #2236 may have resolved this.

jackc avatar Jan 25 '25 14:01 jackc