Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SET ROLE command does not work #6074

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

SET ROLE command does not work #6074

monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working normal SQL

Comments

@monetdb-team
Copy link

Date: 2016-10-13 12:44:34 +0200
From: Martin van Dinther <<martin.van.dinther>>
To: SQL devs <>
Version: 11.23.13 (Jun2016-SP2)
CC: @njnes

Last updated: 2016-12-21 13:08:13 +0100

Comment 24503

Date: 2016-10-13 12:44:34 +0200
From: Martin van Dinther <<martin.van.dinther>>

User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0
Build Identifier:

SQL command: SET ROLE
fails to execute. The error msg is: Role (rolename) missing

Reproducible: Always

Steps to Reproduce:

  1. Start mserver5
  2. Start mclient
  3. Execute SQL Commands:
    SELECT CURRENT_ROLE;
    SELECT name FROM sys.auths;

SET ROLE public;
-- syntax error, unexpected PUBLIC, expecting '=' in: "set role public"
SET ROLE sysadmin;
-- Role (sysadmin) missing

CREATE ROLE r123;
SELECT name FROM sys.auths;
-- new role r123 is visible
SET ROLE r123;
-- Role (r123) missing

-- try some alternative SET ROLE syntax
SET ROLE 'r123';
-- syntax error, unexpected STRING, expecting '=' in: "set role 'r123'"
SET ROLE = r123;
-- Variable role unknown
SET CURRENT_ROLE r123;
-- syntax error, unexpected CURRENT_ROLE in: "set current_role"

SELECT CURRENT_ROLE;

DROP ROLE r123;

SELECT name FROM sys.auths;
SELECT CURRENT_ROLE;

Actual Results:

bash-4.3$ mclient
Welcome to mclient, the MonetDB/SQL interactive terminal (unreleased)
Database: MonetDB v11.24.0 (unreleased), 'demo'
Type \q to quit, ? for a list of available commands
auto commit mode: on
sql>SELECT CURRENT_ROLE;
+--------------+
| single_value |
+==============+
| monetdb |
+--------------+
1 tuple (0.501ms)
sql>SELECT name FROM sys.auths;
+----------+
| name |
+==========+
| public |
| sysadmin |
| monetdb |
+----------+
3 tuples (0.742ms)
sql>
sql>SET ROLE public;
syntax error, unexpected PUBLIC, expecting '=' in: "set role public"
sql>SET ROLE sysadmin;
Role (sysadmin) missing
sql>
sql>CREATE ROLE r123;
operation successful (26.186ms)
sql>SELECT name FROM sys.auths;
+----------+
| name |
+==========+
| public |
| sysadmin |
| monetdb |
| r123 |
+----------+
4 tuples (1.839ms)
sql>SET ROLE r123;
Role (r123) missing
sql>SET ROLE 'r123';
syntax error, unexpected STRING, expecting '=' in: "set role 'r123'"
sql>SET ROLE = r123;
Variable role unknown
sql>SET CURRENT_ROLE r123;
syntax error, unexpected CURRENT_ROLE in: "set current_role"
sql>
sql>SELECT CURRENT_ROLE;
+--------------+
| single_value |
+==============+
| monetdb |
+--------------+
1 tuple (0.280ms)
sql>
sql>DROP ROLE r123;
operation successful (14.647ms)
sql>
sql>SELECT name FROM sys.auths;
+----------+
| name |
+==========+
| public |
| sysadmin |
| monetdb |
+----------+
3 tuples (1.759ms)
sql>SELECT CURRENT_ROLE;
+--------------+
| single_value |
+==============+
| monetdb |
+--------------+
1 tuple (0.321ms)
sql>

Expected Results:

A successful setting/change of the current role.

Comment 24517

Date: 2016-10-16 17:56:56 +0200
From: @njnes

See the Users/Role/schema tests for an example on how to create, grant and set role's. The errors may need some work, suggestions are welcome

@monetdb-team monetdb-team added bug Something isn't working normal SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants