Skip to content

Name an unnamed CREATE INDEX the way PostgreSQL does - #146

Merged
LucaCappelletti94 merged 3 commits into
mainfrom
upstream/unnamed-index-name
Oct 28, 2026
Merged

LucaCappelletti94 merged 3 commits into
mainfrom
upstream/unnamed-index-name

Conversation

@LucaCappelletti94

@LucaCappelletti94 LucaCappelletti94 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

CREATE INDEX ON t (s) stored the index with no name, while PostgreSQL names it t_s_idx. A later DROP INDEX t_s_idx failed with DropIndexNotFound, and CREATE TABLE t_s_idx was accepted although the server refuses it as taken.

Applying the statement now gives the index the name PostgreSQL's ChooseIndexName would give it against the catalog as it stands, so it is dropped, renamed and contested like a written one. The column part reuses the existing FigureColname port, taught the types it was missing, and counts INCLUDE columns as PostgreSQL does. A partition's copies of its root's keys go through the same code, which gives them the 63-byte cut they lacked. An expression whose PostgreSQL name the port does not model leaves the index unnamed as before, since a guessed name would be worse than none.

ParserDBIngestor::create_index_name answers the name applying a CREATE INDEX would store, so a consumer that translates the statement itself, such as pg2sqlite, can emit the same name.

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LucaCappelletti94
LucaCappelletti94 changed the base branch from upstream/function-execute-privileges to main October 27, 2026 20:10
@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/unnamed-index-name branch from 5acae03 to 955d8a8 Compare October 27, 2026 20:15
@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/unnamed-index-name branch from 955d8a8 to 493fb7c Compare October 28, 2026 11:14
@LucaCappelletti94
LucaCappelletti94 merged commit b135376 into main Oct 28, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant