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

Column for primary key not found in schema if constraint column in uppercase #14340

Open
osipovartem opened this issue Jan 28, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@osipovartem
Copy link

Describe the bug

Query

create table test (COLUMN_NAME TEXT NOT NULL,  constraint COLUMN_NAME_PK primary key (COLUMN_NAME))

triggers the error
Column for primary key not found in schema: COLUMN_NAME

When creating a table, we build a schema and apply normalization to column names with to_ascii_lowercase call, which is enabled by default.
But during constraint check we don't do this for the constraint column name.

To Reproduce

No response

Expected behavior

The query should work without errors

create table test (COLUMN_NAME TEXT NOT NULL,  constraint COLUMN_NAME_PK primary key (COLUMN_NAME))

Additional context

Suggestion to use just to_lowercase (since we don't pass column names with ascii symbols)

.position(|item| *item.to_lowercase() == pk.value.to_lowercase())
@osipovartem osipovartem added the bug Something isn't working label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant