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

mysql reuse model(with ... as ...) generated failed! #3216

Open
Panlq opened this issue Feb 23, 2024 · 1 comment
Open

mysql reuse model(with ... as ...) generated failed! #3216

Panlq opened this issue Feb 23, 2024 · 1 comment
Labels
analyzer 📚 mysql bug Something isn't working

Comments

@Panlq
Copy link

Panlq commented Feb 23, 2024

Version

1.25.0

What happened?

A bug happened!

Relevant log output

sqlc generate failed.
# package 
query.sql:12:24: table alias "b" does not exist

Database schema

CREATE TABLE authors (
  `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
  `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT 'name',
  `status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT 'status'
);

SQL queries

-- name: TestReuseModel :many

WITH filtered_data AS (
    SELECT *
    FROM authors where id in (sqlc.slice("id"))
)

SELECT a.id
FROM filtered_data AS a
LEFT JOIN filtered_data AS b
    ON a.id = b.id AND b.name != ?
WHERE b.name IS NULL;

Configuration

No response

Playground URL

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

What operating system are you using?

No response

What database engines are you using?

No response

What type of code are you generating?

No response

@Panlq Panlq added bug Something isn't working triage New issues that hasn't been reviewed labels Feb 23, 2024
@Jille
Copy link
Contributor

Jille commented Feb 27, 2024

I expect #3220 to fix this

@kyleconroy kyleconroy added 📚 mysql analyzer and removed triage New issues that hasn't been reviewed labels Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer 📚 mysql bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants