Document the right use of named parameter substitution in N1QL

Description

Please document the right usage for named parameter substitution for N1QL queries. The following query throws a syntax error regarding the use of named parameter substitution -

UPDATE myBucket USE KEYS["myDocId"] SET $myCounter = $myCounter + 1;

error is as follows -

[ { "code": 3000, "msg": "syntax error - at $myCounter", "query_from_user": "UPDATE destination USE KEYS[\"myDocId\"] SET $myCounter = $myCounter + 1;" } ]

I recollect that there was page in documentation describing the clauses (such as WHERE, FROM etc.) only after which the named parameter substitution was permissible. But I'm unable to find it now.

Environment

None

Release Notes Description

None

Activity

Show:

Beth Favini September 19, 2023 at 7:00 PM

This ticket is being closed as part of the docs team’s effort to increase focus on relevant doc work. We are closing all open tickets that were created before January 2022. This bulk change will help us better manage a large historical backlog and identify high-priority issues. We’ve tagged all tickets closed as part of this effort with the label bulkclosed20230919. We encourage you to reopen this and any other ticket you think is still relevant.

Sriram Melkote December 5, 2020 at 5:17 PM
Edited

to clarify, I'd like this bug to be utilized for N1QL folks to document positional and named parameters within N1QL language (and so the bug now has no relation to eventing) – i.e., address the below portion of Gautham's comment:

— I recollect that there was page in documentation describing the clauses (such as WHERE, FROM etc.) only after which the named parameter substitution was permissible. But I'm unable to find it now.

If reusing this bug this way is confusing, please let me know, I can close and open a fresh bug exclusively for N1QL docs.

Jon Strabala December 4, 2020 at 7:40 PM
Edited

 just so you know both styles "positional parameter(s)" and "named parameter(s)" are fully described in the scriptlet "basicN1qlPreparedSelectStmt"

https://docs.couchbase.com/server/current/eventing/eventing-handler-basicN1qlPreparedSelectStmt.html

On Nov 3, I also updated https://docs.couchbase.com/server/current/eventing/eventing-language-constructs.html#n1ql_call to show both styles.

 or if your happy please resolve this.

Alternatively if you want better documentation surrounding inline N1QL and variables - as opposed to the N1QL() function and positional and named parameters please let me know and I will work on clarifying that.

Jon Strabala October 16, 2020 at 10:38 PM

 I have no problem doing this in the docs, but I have only been able to get positional parameters to work if you or the team can provide me a sample I will update the docs and Simon can clean my work up.

Sriram Melkote October 14, 2020 at 7:26 AM
Edited

The lack of understanding around named/positional parameters is causing a lot of confusion. Can we please prioritize documenting where named/positional parameters can and cannot appear in parameterized queries?

We also need to call out behavior of PREPARE statement in regard to named/positional parameters if it has different restrictions than the underlying statement that is being prepared.

Thank you!

Won't Fix
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Labels

Story Points

Components

Affects versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created November 15, 2018 at 5:16 AM
Updated September 19, 2023 at 7:00 PM
Resolved September 19, 2023 at 7:00 PM
Instabug