From b724d864f8d64027fd791ffdba661dfb70d6ad88 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 10 Feb 2017 09:49:08 +0000 Subject: [PATCH] Add ability to define NAMESPACE without DATABASE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Once somebody had specified USE NAMESPACE to select a namespace, it was not possible to DEFINE a DATABASE underneath the NAMESPACE, as an error that ‘no database is selected’ would be returned. Not it is possible to DEFINE DATABASE having selected only a NAMESPACE. --- sql/options.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sql/options.go b/sql/options.go index ec18a10b..626e09fd 100644 --- a/sql/options.go +++ b/sql/options.go @@ -54,7 +54,12 @@ func (o *options) get(kind int) (kv, ns, db string, err error) { return } - if ns == "" || db == "" { + if kind >= AuthNS && ns == "" { + err = &BlankError{} + return + } + + if kind >= AuthDB && db == "" { err = &BlankError{} return }