Open
Description
Version
1.27.0
What happened?
When a query checks if a sqlc.narg
is null OR in a sqlc.slice
it causes "github.com/lib/pq"
to be imported.
Simply id IN (sqlc.slice('author_ids')
does not.
Relevant log output
No response
Database schema
CREATE TABLE authors (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name text NOT NULL,
bio text
);
SQL queries
-- name: CausesPgToBeImported :many
SELECT
id AS author_id,
name AS author_name,
bio AS author_bio
FROM
authors
WHERE
(sqlc.narg('author_ids') IS NULL OR id IN (sqlc.slice('author_ids')));
Configuration
version: "2"
sql:
- engine: "mysql"
queries: "query.sql"
schema: "schema.sql"
gen:
go:
package: "tutorial"
out: "tutorial"
Playground URL
https://play.sqlc.dev/p/0393067265d4e28076917f8b00b10e81d231a95ca79cdf222cf8ed61de62bffa
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity