镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[DOC-13905][AI] Correct the nested-access queries on the SQL++ versus SQL page - #4203

Draft
TimLFletcher wants to merge 1 commit into
release/8.0from
DOC-13905
Draft

TimLFletcher wants to merge 1 commit into
release/8.0from
DOC-13905

Conversation

@TimLFletcher

@TimLFletcher TimLFletcher commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes DOC-13905.

What changed

modules/learn/pages/data/n1ql-versus-sql.adoc, in Data Selection. Three examples put nested access in the FROM clause and selected the alias, which is the inversion of how {sqlpp} works.

-  SELECT FullTime FROM HRData.Status
+  SELECT Status.FullTime FROM HRData

-SELECT firstjob FROM HRData.History[0] AS firstjob
+SELECT History[0] AS firstjob FROM HRData

-SELECT firstjob[2] FROM HRData.History[0] AS firstjob
+SELECT History[0][2] AS firstjob FROM HRData

The third example's result also changes, because the AS alias names the output field:

-     'firstjob[2]': 2006
+     'firstjob': 2006

Sources

Claim Source
The documented queries are invalid Ticket, from @yuvraj Kanwar
Nested access goes in the projection with the alias, and the keyspace in FROM The Slack thread linked from the ticket, supplied by @tim Fletcher: "Your query should be: SELECT reviews[0] AS x FROM hotel;"

The ticket carries a screenshot and a Slack link rather than the corrected text; the pattern above came from that thread.

Beyond the literal example

Two things go slightly past SELECT reviews[0] AS x FROM hotel, so flagging them:

  1. SELECT Status.FullTime FROM HRData applies the same correction to dot access rather than array indexing. Same error class, same fix shape, but it is a dot-notation case and the quoted example is an array one.
  2. History[0][2] chains two subscripts to keep the example's original meaning, element 2 of the first job. The quoted example indexes once.

Both read as correct {sqlpp} to me, but neither is literally what the thread showed. Worth a glance from whoever has the thread.

Noticed, not changed

Data Projection above has SELECT Name, History, {'FullTime': true} AS 'Status', which single-quotes the alias. That is a different error from the one this ticket reports, so it is left alone.

Other branches

release/8.5 and release/7.6 both carry the same page and the same queries. This PR covers release/8.0 only.

Verification

PASS[docs-server @ DOC-13905 vs baseline release/8.0]: no new build diagnostics.

The build renders the page but does not execute the queries.

🤖 Generated with Claude Code

… SQL page

Three examples put nested field and array access in the FROM clause and then
selected the alias. The access belongs in the projection, with the keyspace
in FROM.

Also corrected a result key: with an AS alias the field is named by the
alias, so firstjob[2] becomes firstjob.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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