Examples or documentation for "WHERE field IN $1" - should be "WHERE field IN ($1)"
- Dominant language
- Go
- Stars
- 14.3k
- Forks
- 1.1k
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 11
Description
**Is your feature request related to a problem? Please describe.**
I ran into a hard-to-debug situation with a query like the following:
```
roleAssignmentUuids := []string{"a-a-a", "b-b-b"}
queryStr := `
SELECT stuff FROM table
WHERE role_assignment_id IN $1;`
// this is wrong, it only works when you use ($1)
rows, err := client.Query(ctx, queryStr, roleAssignmentUuids)
```
**Describe the solution you'd like**
Provide an example in `examples/` that demonstrates the correct placeholder usage in this case.
**Describe alternatives you've considered**
An alternative would be to prevent against this case in code, but, eh.
Contributor guide
Research direction
Start by reviewing the existing examples/ directory and the issue's Go query example. Add an example showing the correct PostgreSQL placeholder syntax for an array passed to IN, including parentheses around $1. Done means the example clearly contrasts the incorrect and correct forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100