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

Not possible to scan into pq.Array(&[]pq.NullTime) in lib/pq@v1.10.7 #1110

Open
Strum355 opened this issue Mar 3, 2023 · 0 comments
Open

Comments

@Strum355
Copy link

Strum355 commented Mar 3, 2023

With a column of type TIMESTAMPTZ aggregated into one row's return column of type TIMESTAMPTZ[] via array_agg, the following doesnt return an error but marks each pq.NullTime.Valid as false.

The stacktrace:
image

The variables and code location:
image

The stringified value yields: 2023-03-03 17:43:52.010562+00 (without single or double quotes). Given that its []byte and not time.Time, the assert fails.

type PackageRepoReference struct {
		ID            int
		Scheme        string
		Name          string
		Blocked       bool
		LastCheckedAt *time.Time
	}
	var ref PackageRepoReference
	var (
		versionStrings []string
		ids            []int64
		blocked        []bool
		lastCheckedAt  []pq.NullTime
	)
	err := s.Scan(
		&ref.ID,
		&ref.Scheme,
		&ref.Name,
		&ref.Blocked,
		&ref.LastCheckedAt,
		pq.Array(&ids),
		pq.Array(&versionStrings),
		pq.Array(&blocked),
		pq.Array(&lastCheckedAt),
	)
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

No branches or pull requests

1 participant