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

release-19.1: sql: allow inverted indexes on mixed-case cols #45678

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/sql/backfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ func (sc *SchemaChanger) validateInvertedIndexes(
col := idx.ColumnNames[0]
row, err := evalCtx.InternalExecutor.QueryRow(ctx, "verify-inverted-idx-count", txn,
fmt.Sprintf(
`SELECT coalesce(sum_int(crdb_internal.json_num_index_entries(%s)), 0) FROM [%d AS t]`,
`SELECT coalesce(sum_int(crdb_internal.json_num_index_entries(%q)), 0) FROM [%d AS t]`,
col, tableDesc.ID,
),
)
Expand Down
17 changes: 12 additions & 5 deletions pkg/sql/logictest/testdata/logic_test/inverted_index
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ statement ok
CREATE TABLE c (
id INT PRIMARY KEY,
foo JSON,
bar JSON,
"bAr" JSON,
"qUuX" JSON,
INVERTED INDEX (foo),
INVERTED INDEX (bar)
INVERTED INDEX ("bAr")
)

query TT
Expand All @@ -39,13 +40,19 @@ SHOW CREATE TABLE c
c CREATE TABLE c (
id INT8 NOT NULL,
foo JSONB NULL,
bar JSONB NULL,
"bAr" JSONB NULL,
"qUuX" JSONB NULL,
CONSTRAINT "primary" PRIMARY KEY (id ASC),
INVERTED INDEX c_foo_idx (foo),
INVERTED INDEX c_bar_idx (bar),
FAMILY "primary" (id, foo, bar)
INVERTED INDEX "c_bAr_idx" ("bAr"),
FAMILY "primary" (id, foo, "bAr", "qUuX")
)

# Regression test for #42944: make sure that mixed-case columns can be
# inverted indexed.
statement ok
CREATE INVERTED INDEX ON c("qUuX")

statement error indexing more than one column with an inverted index is not supported
CREATE TABLE d (
id INT PRIMARY KEY,
Expand Down