Skip to content

RSCBC-285: create_index cannot index nested fields properly - #493

Open
Matt-Woz wants to merge 1 commit into
mainfrom
RSCBC-285
Open

RSCBC-285: create_index cannot index nested fields properly#493
Matt-Woz wants to merge 1 commit into
mainfrom
RSCBC-285

Conversation

@Matt-Woz

@Matt-Woz Matt-Woz commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Motivation

Currently the create_index escapes the fields that are passed in, this means that a field like d.firstName was parsed as '`d.firstName`' and not '`d`.`firstName`'. This meant that it was not possible to index nested fields properly. Likewise in the case when backticks were needed in the field name itself, escaping the backticks would cause the server to return a syntax error.

Changes

Stop escaping index field names and pass them as is to allow indexing nested fields

Notes

This change may break anyone who was relying on the SDK escaping the index names, e.g. trying to index non-nested fields with dots in their name, or when reserved words are used, in which case backticks will have to be added to the user's field input.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes query index creation so nested field paths (e.g. d.firstName) can be indexed correctly, avoiding the previous behavior where the SDK wrapped the entire string as a single escaped identifier (e.g. `d.firstName`).

Changes:

  • Stop escaping CreateIndexOptions.fields when building the CREATE INDEX statement so callers can provide nested paths / explicit quoting.
  • Preserve existing behavior for other parts of the statement (e.g., keyspace building, WITH options, error handling).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sdk/couchbase-core/src/queryx/query.rs Outdated
Comment thread sdk/couchbase-core/src/queryx/query.rs Outdated
@github-actions

Copy link
Copy Markdown

🐰 Bencher Report

BranchRSCBC-285-29503958206-188-1
Testbedubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
query📈 view plot
🚷 view threshold
449.41 µs
(+6.74%)Baseline: 421.03 µs
484.19 µs
(92.82%)
upsert_and_get📈 view plot
🚷 view threshold
419.47 µs
(+4.10%)Baseline: 402.93 µs
463.37 µs
(90.53%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown

🐰 Bencher Report

BranchRSCBC-285-29504345289-189-1
Testbedubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
query📈 view plot
🚷 view threshold
442.10 µs
(+5.00%)Baseline: 421.03 µs
484.19 µs
(91.31%)
upsert_and_get📈 view plot
🚷 view threshold
419.33 µs
(+4.07%)Baseline: 402.93 µs
463.37 µs
(90.50%)
🐰 View full continuous benchmarking report in Bencher

@chvck chvck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably have a test for this

@github-actions

Copy link
Copy Markdown

🐰 Bencher Report

BranchRSCBC-285-29517304317-190-1
Testbedubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
query📈 view plot
🚷 view threshold
453.43 µs
(+7.71%)Baseline: 420.97 µs
484.11 µs
(93.66%)
upsert_and_get📈 view plot
🚷 view threshold
435.49 µs
(+9.39%)Baseline: 398.11 µs
457.82 µs
(95.12%)
🐰 View full continuous benchmarking report in Bencher

@Matt-Woz
Matt-Woz requested a review from chvck July 27, 2026 08:55
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.

3 participants