Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
andrewmbenton opened this issue Sep 20, 2023 · 0 comments

Comments

@andrewmbenton
Copy link
Collaborator

andrewmbenton commented Sep 20, 2023

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

@andrewmbenton andrewmbenton added bug Something isn't working triage New issues that hasn't been reviewed labels Sep 20, 2023
@kyleconroy kyleconroy removed the triage New issues that hasn't been reviewed label Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants