Bug 6208

Summary: Add support to specify execution of some SQL commands at login time for a specific user
Product: SQL Reporter: Martin van Dinther <martin.van.dinther>
Component: allAssignee: SQL devs <bugs-sql>
Status: NEW ---    
Severity: enhancement    
Priority: Normal    
Version: 11.25.5 (Dec2016-SP1)   
Hardware: All   
OS: All   

Description Martin van Dinther cwiconfidential 2017-02-09 16:32:33 CET
User-Agent:       Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0
Build Identifier: 

Multiple users request possibility to execute some SQL statements/script (such as setting query/session timeout, setting time zone, changing schema, etc.) directly after making a connection by a user. This should be done each time a user connects to the MonetDB server and independent of the used client program.
So be part of the user definition as stored in the server.

See https://www.monetdb.org/pipermail/users-list/2017-February/009688.html
https://www.monetdb.org/bugzilla/show_bug.cgi?id=3322
https://www.monetdb.org/bugzilla/show_bug.cgi?id=3426

Proposed SQL could be: ALTER USER <username> SET logon_cmd = '<the SQL commands>';
For this the system table db_user_info needs to be extended wit an extra column: logon_cmd string;
Initially when the user is created it will be NULL.
It can be set (only by sys admin) via: ALTER USER <username> SET logon_cmd = '<SQL commands>';
It can be unset/cleared via ALTER USER <username> SET logon_cmd = NULL;

It should also allow to specify a set of SQL commands (separated by ;) such as:
ALTER USER "test_user" SET logon_cmd = 'call sys.settimeout(20); call sys.setsession(100); set time zone local;';

Optionally it should also allow to call a user defined stored procedure, such that more complex scripts could be defined in one stored procedure. This allows definition and testing of the script/procedure to be independent of the logon cmd and ease the setting of the same logon_cmd for multiple users.


Reproducible: Always