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

[BUG]: 'left' column name not escaped in index #2425

Closed
rogino opened this issue Jun 3, 2024 · 2 comments
Closed

[BUG]: 'left' column name not escaped in index #2425

rogino opened this issue Jun 3, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rogino
Copy link

rogino commented Jun 3, 2024

What version of drizzle-orm are you using?

0.31.0

What version of drizzle-kit are you using?

0.22.1

Describe the Bug

The 0.21.0 schema upgrade has broken one of my indexes:

export const entries = makeTable(
  "entries",
  {
    // ...
    left: timestamp("left"),
  },
  (table) => ({
    leftNullIdx: index("entries_left_null_idx")
      .on(table.left)
      .where(isNull(table.left)),
  })
);

Upon upgrading, it deleted the existing index and created a new one:

CREATE INDEX IF NOT EXISTS "entries_left_null_idx" ON "entries" USING btree (left) WHERE "entries"."left" is null;--> statement-breakpoint

However, Postgres tries to interpret left as a keyword instead of the column name, and thus fails.

Expected behavior

The migration command should quote the column name in USING btree (column_name).

Environment & setup

No response

@rogino rogino added the bug Something isn't working label Jun 3, 2024
@mandarzope
Copy link

@rogino
I had same error for a column name table. It seems restricted keywords can not be the column names.

image

@AndriiSherman
Copy link
Member

Should be fixed in [email protected]

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

3 participants