Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-2955

CreateIndexAsync doesn't escape bucket names with dashes

    XMLWordPrintable

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • 3.3.0
    • None
    • None
    • 1

    Description

      Seen implementing snippets for NCBC-2719

      await userCluster.QueryIndexes.CreatePrimaryIndexAsync(                
          $"`{bucketName}`",
          new CreatePrimaryQueryIndexOptions().IgnoreIfExists(true));  

      Note I've had to escape bucketName myself.

      If I simply pass bucketName then I'd get the following error:

      Couchbase.Core.Exceptions.ParsingFailureException: syntax error - at - [3000]
         at Couchbase.Query.QueryResultExtensions.ThrowExceptionOnError[T](IQueryResult`1 result, QueryErrorContext context)
         at Couchbase.Query.QueryClient.ExecuteQuery[T](QueryOptions options, ITypeSerializer serializer, IRequestSpan span)
         at Couchbase.Query.QueryClient.QueryAsync[T](String statement, QueryOptions options)
         at Couchbase.Management.Query.QueryIndexManager.CreatePrimaryIndexAsync(String bucketName, CreatePrimaryQueryIndexOptions options)
         at Submission#0.UserManagementExample.Example3() in /Users/hakimcassimally/couchbase/docs-sdk-dotnet/modules/howtos/examples/UserManagementExample.csx:line 91
         at Submission#0.UserManagementExample.ExampleAsync() in /Users/hakimcassimally/couchbase/docs-sdk-dotnet/modules/howtos/examples/UserManagementExample.csx:line 33
         at Submission#0.<<Initialize>>d__0.MoveNext() in /Users/hakimcassimally/couchbase/docs-sdk-dotnet/modules/howtos/examples/UserManagementExample.csx:line 16
      --- End of stack trace from previous location ---
         at Dotnet.Script.Core.ScriptRunner.Execute[TReturn](String dllPath, IEnumerable`1 commandLineArgs) in /private/var/folders/6j/4hkjjhd50fg27s933nctz0480000gn/T/tmp3iI6tV/Dotnet.Script.Core/ScriptRunner.cs:line 52
      -----------------------Context Info---------------------------
      {"Statement":"[{\"statement\":\"CREATE PRIMARY INDEX ON travel-sample USING GSI WITH {\\\"defer_build\\\":False};\",\"client_context_id\":\"d3169dbd-3774-404b-ae89-2caf172c3c3a\"}]","ClientContextId":"d3169dbd-3774-404b-ae89-2caf172c3c3a","Parameters":"{\"Named\":{},\"Raw\":{},\"Positional\":[]}","HttpStatus":400,"QueryStatus":6,"Errors":[{"msg":"syntax error - at -","Code":3000,"Name":null,"Severity":0,"Temp":false}],"Message":"syntax error - at - [3000]"} 

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            jmorris Jeff Morris added a comment -

            This is closed, but the underlying issue still exists. Relates to NCBC-2543

            jmorris Jeff Morris added a comment - This is closed, but the underlying issue still exists. Relates to NCBC-2543
            jmorris Jeff Morris added a comment - NCBC-3107

            People

              jmorris Jeff Morris
              hakim.cassimally Hakim Cassimally
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty