sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Parameters in DELETE FROM .. LEFT JOIN .. ON clause ignored

Open Jille opened this issue 1 year ago • 0 comments

Version

1.27.0

What happened?

It looks like sqlc doesn't understand parameters in the ON clause of a LEFT JOIN for a DELETE query. It does work for a SELECT query.

In the linked playground example, it creates a method with zero arguments instead of one.

Relevant log output

No response

Database schema

CREATE TABLE perma (
  instance CHAR(12) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
  id INT UNSIGNED NOT NULL,
  PRIMARY KEY(instance, object_id)
);

CREATE TEMPORARY TABLE tempo (
  object_id INT UNSIGNED NOT NULL PRIMARY KEY
);

SQL queries

-- name: DeleteLeftJoin :exec
DELETE perma FROM perma LEFT JOIN tempo next ON tempo.object_id = perma.object_id AND perma.instance=? WHERE perma.id IS NULL ;

Configuration

No response

Playground URL

https://play.sqlc.dev/p/36f3fa4197f27bbec82809617fb49cde4b8e7d099305b4686a8686c0def7b475

What operating system are you using?

Linux

What database engines are you using?

MySQL

What type of code are you generating?

Go

Jille avatar Oct 03 '24 15:10 Jille