Skip to content

fix: drop indexes before columns their predicates or expressions use - #317

Open
xishell wants to merge 1 commit into
stripe:mainfrom
xishell:fix/index-drop-before-referenced-column
Open

xishell wants to merge 1 commit into
stripe:mainfrom
xishell:fix/index-drop-before-referenced-column

Conversation

@xishell

@xishell xishell commented Oct 1, 2026

Copy link
Copy Markdown

Description

column_names in GetIndexes only came from indkey, which misses columns used in index expressions and predicates. This adds those columns from pg_depend, so addDepsOnRelationAddAlterIfNecessary drops the index before the column.

Motivation

Fixes #316

Testing

Added acceptance cases for a predicate-only column, an expression column and a partitioned table. All fail without the change. Full suite passes on Postgres 16 and 17. On 14 and 15 I only see the temp database CREATE DATABASE hitting the 3s statement timeout locally, which main does too. Lint clean, sqlc regenerated with the codegen image.

@cla-assistant

cla-assistant Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

[BUG] Dropping a column referenced only by an index predicate or expression fails

1 participant