sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
13.51k stars 810 forks source link

sqlc compile does not report issues in sql files #3703

Open zbelial opened 1 week ago

zbelial commented 1 week ago

Version

1.27.0

What happened?

I wanted to use sqlc compile to check sql syntax errors, but I didn't get what I expected.

The following schema and queries were copied from sqlc document to used for testing.

Could you please help me figure out where the problem was? thanks.

Relevant log output

nothing

Database schema

CREATE TABLE authors (
  id   BIGINT  NOT NULL AUTO_INCREMENT PRIMARY KEY,
  name text    NOT NULL,
  bio  text
);

SQL queries

-- name: GetAuthor :one
SELECT * FROM authors
WHERE id = ? LIMIT 1;

-- name: ListAuthors :many
SELECT * FROM authors
ORDER BY name;

-- name: CreateAuthor :execresult
INSERT INTO authors (
  name, bio
) VALUES (
  ?, ?
);

-- name: DeleteAuthor :exec
DELETE FROM authors
WHERE id = ?;

Configuration

version: "2"
sql:
  - engine: "postgresql"
    queries: "query-pg.sql"
    schema: "schema-pg.sql"

Playground URL

No response

What operating system are you using?

Linux

What database engines are you using?

PostgreSQL

What type of code are you generating?

No response