'CouchDB not allowing '+' in database name

CouchDB v3.2.1 on Ubuntu 20.04.4

curl -X PUT https://localhost:6984/test+database --cookie 'AuthSession=<session cookie>'

gives the error:

{"error":"illegal_database_name","reason":"Name: 'test database'. Only lowercase characters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Must begin with a letter."}

Trying to create the database using Fauxton gives the same error.

Notice that in the error message it is changing '+' to ' '.

I've seen other questions here regarding not being able to delete a database with a '+' in the name as well. Is this a recent bug in couchdb where it no longer allows '+'?



Solution 1:[1]

Indeed a + is a legal character for a database name according to PUT /{db}:

Creates a new database. The database name {db} must be composed by following next rules:

  • Name must begin with a lowercase letter (a-z)
  • Lowercase characters (a-z)
  • Digits (0-9)
  • Any of the characters _, $, (, ), +, -, and /.

SO to the problem at hand - simply percent encode that +

curl -X PUT https://localhost:6984/test%2Bdatabase --cookie 'AuthSession=<session cookie>'

This is a curl thing, not a couchdb thing.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RamblinRose