Skip to content

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

Open

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

Activity

  1. added
    bugSomething isn't working
    triageNew issues that hasn't been reviewed
    on Sep 20, 2023
  2. removed
    triageNew issues that hasn't been reviewed
    on Sep 21, 2023
  3. added 2 commits that reference this issue on Sep 21, 2023
    290bf69
    1a45689
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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