Skip to content

Querry appends .* to last column in SELECT when trying to use "table".*  #1444

Closed
@nd291195

Description

@nd291195

Version

1.12.0

What happened?

When I join two tables and try to select everything from only one of them using the "table".* syntax the generated code has .* appended to the last column in the SELECT statement of the query. This only happens if the table name is written in quotes.

Relevant log output

const bookFindByName = `-- name: BookFindByName :many
select book.id, book.name.*
from "book"
`

Database schema

create table if not exists "book"
(
  "id"         bigint generated by default as identity not null,
  "name" timestamptz,
  primary key ("id")
);

create table if not exists "author"
(
  "id"         bigint generated by default as identity not null,
  "name" timestamptz,
  primary key ("id")
);

create table if not exists "book_author"
(
  "book_id"       bigint not null,
  "author_id"	  bigint not null,
  primary key ("id")
);

SQL queries

-- name: BookFindBySome :many
select "book".*
from "book";

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "postgresql",
      "schema": "query.sql",
      "queries": "query.sql"
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/3e11ceef30748363dded68181cd1ee514a22e602642956351cb2a4511af55ee1

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions