sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

No result table columns when using named subselect with join

Open peteole opened this issue 3 years ago • 0 comments

Version

1.12.0

What happened?

running sqlc generate on a select statement that uses a subselect that includes a join operation results in an empty columnset

Relevant log output

# package sqlc
sql-queries/projects.sql:159:1: empty edit contents

Database schema

CREATE TABLE public.projects (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    name character varying(100) NOT NULL
);
CREATE TABLE public.project_saves (
    user_id uuid NOT NULL,
    project_id uuid NOT NULL,
    created_at timestamp without time zone DEFAULT now()
);

SQL queries

SELECT r.*
FROM (
        project_saves
        JOIN projects
        ON project_saves.project_id = projects.id
    ) r;

Configuration

version: "1"
packages:
  - path: "sqlc"
    name: "sqlc"
    engine: "postgresql"
    schema: "schema.sql"
    queries: "sql-queries"

Playground URL

https://play.sqlc.dev/p/7a3d51abd4191695fa4412ad377a93f3e6f764b5630dea0cb4e5051390f1d9ea

What operating system are you using?

Linux

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

peteole avatar Mar 31 '22 14:03 peteole