Skip to content

sqlc.embed() fails to recognize table aliases that aren't all lowercase #2745

Open
@andrewmbenton

Description

@andrewmbenton

Version

1.21.0

What happened?

For the following query

-- name: FindAccountById :one
SELECT sqlc.embed(a), sqlc.embed(locMain), sqlc.embed(locAlt)
FROM Account a
LEFT JOIN Locations locMain ON a.MainAddressId = locMain.Id
LEFT JOIN Locations locAlt ON a.AlternateAddressId = locAlt.Id
WHERE a.Id = ? LIMIT 1;

sqlc generates the error below.

It appears this is an issue specific to MySQL though, where identifiers are generally case sensitive.

Relevant log output

# package db
query.sql:23:1: unable to resolve table with "sqlc.embed(locmain)": relation "locmain" does not exist

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

https://play.sqlc.dev/p/57a853fc5c03ece6498a05a4996a75d0f8e28a0a43e91bfcce27bc4ead25732b

What operating system are you using?

Linux

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