Skip to content

Type not propagated from CTE query #3875

Open
@binaek

Description

@binaek

Version

1.28.0

What happened?

Reproduction:

CREATE TABLE authors (
  id   BIGSERIAL PRIMARY KEY,
  name text      NOT NULL,
  bio  text
);
-- name: GetAuthor :one
WITH author as (
  SELECT * FROM authors
  WHERE id = $1
)
SELECT * from author;

The return type of the generated function is SelectCteTestRow - not Author although it's actually returning a Author.

Relevant log output

Database schema

SQL queries

Configuration

Playground URL

https://play.sqlc.dev/p/0d129e7ba6230256015139134fbdadb991601360635c1983117970d299b3df9e

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions