Skip to content

ALTER TABLE ADD COLUMN statement with mixed case column name results in not found #4307

@mem

Description

@mem

Version

1.30.0

What happened?

An ALTER TABLE ... ADD COLUMN statement with a mixed-case column name results in column does not exist error.

If I modify the case in the ALTER TABLE statement to be all lowercase, it works.

In the playground it's using 1.25, but I have verified this happens with 1.30, too.

Relevant log output

query.sql:2:17: column "barbaz" does not exist

Database schema

CREATE TABLE foo (
  id INTEGER NOT NULL PRIMARY KEY,
  xYz INTEGER NOT NULL DEFAULT 0
);

ALTER TABLE foo ADD COLUMN barBaz TEXT NOT NULL DEFAULT '';

SQL queries

-- name: GetOne :one
SELECT id, xYz, barBaz FROM foo WHERE id = ?;

Configuration

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

Playground URL

https://play.sqlc.dev/p/1c10bdf06465cd0a1bf7237b01f4e869a9c174d21920a882a891d1114809a27a

What operating system are you using?

Linux

What database engines are you using?

SQLite

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions