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

Missing row on execution #371

Open
fairking opened this issue Jun 7, 2024 · 0 comments
Open

Missing row on execution #371

fairking opened this issue Jun 7, 2024 · 0 comments

Comments

@fairking
Copy link

fairking commented Jun 7, 2024

When I run the following query:

	var query = rel.
		Select("c.id", "c.created_time", "c.updated_time", "c.archived", "c.name", "c.description", "^MAX(n.updated_time) last_note_dated", "^AVG(n.score) avg_score").
		From("contacts as c").
		JoinWith("LEFT JOIN", "notes as n", "n.object_id", "c.id", where.Eq("n.archived", false)).
		Where(where.Eq("c.archived", false)).
		Group("c.id", "c.created_time", "c.updated_time", "c.archived", "c.name", "c.description")

The query must return two records, but instead it returns only one.
The missing records is the one which has no notes associated. If I copy the query from the instrumentation log and run it manually against the db, it returns two records.

However if I modify the query to (see as):

	var query = rel.
		Select("c.id", "c.created_time", "c.updated_time", "c.archived", "c.name", "c.description", "^MAX(n.updated_time) as last_note_dated", "^AVG(n.score) as avg_score").
		From("contacts as c").
		JoinWith("LEFT JOIN", "notes as n", "n.object_id", "c.id", where.Eq("n.archived", false)).
		Where(where.Eq("c.archived", false)).
		Group("c.id", "c.created_time", "c.updated_time", "c.archived", "c.name", "c.description")

I have got the following error (similar to #370):

sql: Scan error on column index 6, name \"last_note_dated\": unsupported Scan, storing driver.Value type string into type *time.Time", err:(*errors.errorString)(0xc0003f7940)

Looks like something bad is going on when queries got executed. I am probably thinking to quit go-rel as it constantly prevents me from progressing my project.

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