Skip to content

Argument inside CTE not detectedΒ #3990

Open
@cjtheham

Description

@cjtheham

Version

1.29.0

What happened?

Using a CTE (WITH) before a SELECT statement with a ? argument in it (or sqlc.arg() call) - the argument is not detected by SQLC causing a missing argument error. Below is a redacted version of the query with the issue presented.

Relevant log output

Database schema

SQL queries

WITH submissions AS (
  SELECT *
  FROM 
    submissions 
  WHERE 
    submissions.id = ?
) 

SELECT *
FROM contracts 

WHERE contracts.id = ?;

Configuration

version: "1"
packages:
  - name: db
    path: db_generated
    schema: schema/*
    queries: queries/
    engine: mysql
    database:
      managed: true

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

MySQL

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