Skip to content

sql: clarify the error message upon access to vtable with no db#24772

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
knz:20180413-virt-nodb
Apr 15, 2018
Merged

sql: clarify the error message upon access to vtable with no db#24772
craig[bot] merged 1 commit intocockroachdb:masterfrom
knz:20180413-virt-nodb

Conversation

@knz
Copy link
Copy Markdown
Contributor

@knz knz commented Apr 13, 2018

Fixes #23958.

Prior to this patch:

root@:26257/> select * from pg_catalog.pg_class;
pq: no database specified

After:

root@:26257/> select * from pg_catalog.pg_class;
pq: cannot access virtual schema in anonymous database
HINT: verify that the current database is set

Release note (sql change): the error message produced upon accessing a
virtual schema with no database prefix (e.g. when database is not
set) is now clarified.

Prior to this patch:

```
root@:26257/> select * from pg_catalog.pg_class;
pq: no database specified
```

After:

```
root@:26257/> select * from pg_catalog.pg_class;
pq: cannot access virtual schema in anonymous database
HINT: verify that the current database is set
```

Release note (sql change): the error message produced upon accessing a
virtual schema with no database prefix (e.g. when `database` is not
set) is now clarified.
@knz knz requested review from a team and m-schneider April 13, 2018 09:02
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@knz
Copy link
Copy Markdown
Contributor Author

knz commented Apr 13, 2018

@jordanlewis should we cherry-pick this to 2.0.x?


var errInvalidDbPrefix = pgerror.NewError(pgerror.CodeUndefinedObjectError,
"cannot access virtual schema in anonymous database",
).SetHintf("verify that the current database is set")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is there a SetHint without the f?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not yet, no

@jordanlewis
Copy link
Copy Markdown
Member

This seems cherrypickable.

@knz
Copy link
Copy Markdown
Contributor Author

knz commented Apr 15, 2018

bors r+

craig bot pushed a commit that referenced this pull request Apr 15, 2018
24772: sql: clarify the error message upon access to vtable with no db r=knz a=knz

Fixes #23958.

Prior to this patch:

```
root@:26257/> select * from pg_catalog.pg_class;
pq: no database specified
```

After:

```
root@:26257/> select * from pg_catalog.pg_class;
pq: cannot access virtual schema in anonymous database
HINT: verify that the current database is set
```

Release note (sql change): the error message produced upon accessing a
virtual schema with no database prefix (e.g. when `database` is not
set) is now clarified.

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Apr 15, 2018

Build succeeded

@craig craig bot merged commit 3b266d0 into cockroachdb:master Apr 15, 2018
craig bot pushed a commit that referenced this pull request Apr 17, 2018
24809: cherrypick-2.0: sql: clarify the error message upon access to vtable with no db r=knz a=knz

Picks #24772.

cc @cockroachdb/release 

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
@knz knz deleted the 20180413-virt-nodb branch April 27, 2018 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql: make pg_catalog error out cleanly when no cur db set

3 participants