Fix multiline expression index handling - #303
Conversation
Allow CREATE INDEX rewrites to span newlines preserved by pg_get_indexdef, and cover both concurrent creation and non-concurrent plan validation. Fixes stripe#253
|
|
|
Revalidated this change against current Current-main validation:
The public head remains the original GitHub-verified commit because GitHub reports the PR as mergeable and the current-main change does not overlap the patch.
|
Description
pg_get_indexdefcan preserve newlines inside expression index definitions. The existing anchored rewrite uses.*, which does not match newlines in Go, so converting a valid definition toCREATE INDEX CONCURRENTLYfails. The same conversion is also used while validating plans with concurrent index operations disabled.This change enables dot-all matching only for the existing regex, preserving its anchors, case sensitivity, and exact
CREATE [UNIQUE] INDEXprefix. It adds regression coverage for:WithNoConcurrentIndexOps().Testing
GOTOOLCHAIN=go1.25.5 go test -race ./... -timeout 30mgolangci-lint v2.7.0 rungo vet ./...sqlfluff 3.3.0 lintgofmt,go mod tidy -diff, andgit diff --checkThe commit is GitHub Verified.
Fixes #253