Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
junioryono opened this issue Jan 21, 2025 · 1 comment
Open

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

junioryono opened this issue Jan 21, 2025 · 1 comment
Labels

Comments

@junioryono
Copy link

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 junioryono added the bug label Jan 21, 2025
@jackc
Copy link
Owner

jackc commented Jan 25, 2025

Try master. #2236 may have resolved this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants