sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Missing columns not being detected

Open strackfeldt opened this issue 1 year ago • 0 comments

Version

1.26.0

What happened?

Hi, missing columns not being detected when not using parameters

Relevant log output

none

Database schema

create table a (
	id BIGSERIAL primary key
);

create table b (
	id BIGSERIAL primary key
);

SQL queries

-- name: Test :one
select
	*
from
	a
where
	does_not_exist = 'does_not_exist';

-- name: Test2 :one
select
	a.*
from
	a
	join b on a.does_not_exist = b.does_not_exist;

-- -- name: Test3 :one <- THIS GETS DETECTED
-- select
--	*
-- from
--	a
-- where
--	does_not_exist = $1;

Configuration

{
  "version": "2",
  "sql": [{
    "schema": "schema.sql",
    "queries": "query.sql",
    "engine": "postgresql",
    "gen": {
      "go": {
        "out": "db"
      }
    }
  }]
}

Playground URL

https://play.sqlc.dev/p/3c9631eb7dc7e42a6a8c8fa81ee16f51869089c4fbd0f4ae2304d5e801dda5b9

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

strackfeldt avatar Apr 28 '24 11:04 strackfeldt