本文介绍了如何在Couchbase中重命名存储桶?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我使用以下N1QL语句时,我的存储桶名称为 0001 ,我收到"5000"语法错误:
I have a bucket name 0001 when I use the following N1QL statement I get a "5000" syntax error:
cbq> Select * from 0001;
{
"requestID": "f2b70856-f80c-4c89-ab37-740e82d119b5",
"errors": [
{
"code": 5000,
"msg": "syntax error"
}
],
"status": "fatal",
"metrics": {
"elapsedTime": "349.733us",
"executionTime": "204.442us",
"resultCount": 0,
"resultSize": 0,
"errorCount": 1
}
}
我认为它以0001作为数字而不是存储桶名称,是否有一种简单的方法来重命名它?
I think it takes 0001 as a number and not as a bucket name, is there an easy way to rename it?
推荐答案
在这种情况下,您可以在N1QL中使用反勾来转义存储桶名称:
In this case you can use back ticks in N1QL to escape the bucket name:
cbq> Select * from `0001`;
{
"requestID": "f48527e6-6035-47e7-a34f-90efe9f90d4f",
"signature": {
"*": "*"
},
"results": [
{
"0001": {
"Hello": "World"
}
}
],
"status": "success",
"metrics": {
"elapsedTime": "2.410929ms",
"executionTime": "2.363788ms",
"resultCount": 1,
"resultSize": 80
}
}
当前无法重命名存储桶,而可以执行以下操作之一:
Currently there is noway to rename a bucket instead you could do one of the following:
- Backup the bucket using
cbbackup
. Then recreate it and restore it usingcbrestore
. - Create a second cluster and use XDCR to transfer the data to the new cluster with the correctly named bucket.
这篇关于如何在Couchbase中重命名存储桶?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!