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

drop_index operation quoting issue #355

Closed
kostasb opened this issue May 13, 2024 · 0 comments · Fixed by #356
Closed

drop_index operation quoting issue #355

kostasb opened this issue May 13, 2024 · 0 comments · Fixed by #356
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kostasb
Copy link

kostasb commented May 13, 2024

Drop index has trouble with case sensitive names:

[{
"drop_index": {
    "name": "idx_AREA_CODE"
}
}
]

migration is invalid: index "idx_AREA_CODE" does not exist

It requires escaped quotes to work:

[{
"drop_index": {
    "name": "\"idx_AREA_CODE\""
}
}
]
@andrew-farries andrew-farries added the bug Something isn't working label May 14, 2024
@andrew-farries andrew-farries added this to the v1 milestone May 14, 2024
@andrew-farries andrew-farries self-assigned this May 15, 2024
andrew-farries added a commit that referenced this issue May 16, 2024
Fixes #355

Postgres stores index names with uppercase characters in the `pg_index`
catalog using the quoted version of the name. For example:

```
"idx_USERS_name"
```

whereas a lowercase index name would be stored as:

```
idx_users_name
```

This is different to how other object types are stored in their
respective catalogs. For example, table names are stored in
the`pg_class` catalog without quotes, regardless of whether they contain
uppercase characters.

This makes it necessary to strip quotes from index names when retrieving
them from the `pg_index` catalog when building the internal schema
representation.
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

Successfully merging a pull request may close this issue.

2 participants