Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite: running generate on a query using the json_each function results in 'column "value" does not exist' for json_each.value reference #3802

Open
hopesea opened this issue Jan 23, 2025 · 0 comments

Comments

@hopesea
Copy link

hopesea commented Jan 23, 2025

Version

1.28.0

What happened?

Referening the "value" column from json_each function results in the error message 'column "value" does not exist'.
Aliasing the result from json_each function call has no impact either.

Relevant log output

sqlc generate failed.
# package 
query.sql:4:7: 396: column "value" does not exist

Database schema

CREATE TABLE demo (
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	simple_val TEXT,
	compound_json_val TEXT
);

SQL queries

-- name: FetchDemoRowsByJsonVal :many
SELECT demo.*
  FROM demo, json_each(demo.compound_json_val)
WHERE json_each.value IN (sqlc.slice('param'));

Configuration

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

Playground URL

https://play.sqlc.dev/p/b48066cc2ed3aaba5ed85e794b275c9d3b4857b70d0c810b95de28d2e1a0d303

What operating system are you using?

macOS

What database engines are you using?

SQLite

What type of code are you generating?

Go

@hopesea hopesea added the bug Something isn't working label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant