sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Sql WITH query - not parsing 'delete'

Open zoranembroker opened this issue 3 years ago • 1 comments

Version

1.11.0

What happened?

sqlc generate not working with this particular 'with' case.

Relevant log output

dept_list.sql:1:1: relation "dept" does not exist

Database schema

CREATE TABLE company
(
	id   uuid,
	name text
);

CREATE TABLE department
(
	id   uuid,
	name text
);

SQL queries

WITH dept AS (
    select name from department
)
delete from company where name in (select name from dept);

Configuration

No response

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?

Go

zoranembroker avatar Jan 06 '22 14:01 zoranembroker

i can confirm i also ran into this bug

hexcowboy avatar Jun 21 '22 04:06 hexcowboy

This works as of sqlc 1.21 https://play.sqlc.dev/p/f0f1bdc5bbfa7026995ef8eb8797a6e7621f29fa9df6f16d1095bf465a7856b0

kyleconroy avatar Sep 22 '23 19:09 kyleconroy