Skip to content

using :execresult and :batchexec causes invalid import in batch.go #1682

Closed
@jlisthood

Description

@jlisthood

Version

1.14.0

What happened?

batch.go will import "github.com/jackc/pgconn" without using it if you use :execresult and :batchexec in the same query.sql file

Relevant log output

No response

Database schema

-- Example queries for sqlc
CREATE TABLE authors (
  id   BIGSERIAL PRIMARY KEY,
  name text      NOT NULL,
  bio  text
);

SQL queries

-- name: CreateAuthor :execresult
INSERT INTO authors (
  name, bio
) VALUES (
  $1, $2
);

-- name: BatchUpdateBio :batchexec
UPDATE authors
SET bio = $1
WHERE id = $2;

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "postgresql",
      "schema": "query.sql",
      "queries": "query.sql",
      "sql_package": "pgx/v4",
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/3669b609952d7561251d8991ad37a043ce0fdcb44c1dd9f8c927bc607aaec059

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions