Skip to content
Snippets Groups Projects
Commit 3ee4d1f6 authored by Chris Sosnin's avatar Chris Sosnin Committed by Nikita Pettik
Browse files

sql: allow accessing list of collations via pragma

'pragma collation_list' uses _collation space, although user
may have no access to it. Thus, we replace it with the
corresponding view.

Closes #4713

(cherry picked from commit 28370f19)
parent ae1bf8a4
No related merge requests found
......@@ -503,7 +503,7 @@ sqlPragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
case PragTyp_COLLATION_LIST:{
int i = 0;
struct space *space = space_by_name("_collation");
struct space *space = space_by_name("_vcollation");
char key_buf[16]; /* 16 is enough to encode 0 len array */
char *key_end = key_buf;
key_end = mp_encode_array(key_end, 0);
......
......@@ -352,11 +352,13 @@ box.schema.user.create('tmp')
box.session.su('tmp')
---
...
-- Error: read access to space is denied.
box.execute("pragma collation_list")
-- gh-4713 "PRAGMA collation_list" is not accessible to all users
_, err = box.execute('pragma collation_list')
---
- null
- Read access to space '_collation' is denied for user 'tmp'
...
assert(err == nil)
---
- true
...
box.session.su('admin')
---
......
......@@ -98,8 +98,9 @@ box.schema.user.revoke('guest', 'read,write,execute', 'universe')
-- gh-3857 "PRAGMA collation_list" invokes segmentation fault.
box.schema.user.create('tmp')
box.session.su('tmp')
-- Error: read access to space is denied.
box.execute("pragma collation_list")
-- gh-4713 "PRAGMA collation_list" is not accessible to all users
_, err = box.execute('pragma collation_list')
assert(err == nil)
box.session.su('admin')
box.schema.user.drop('tmp')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment