[MDEV-7755] new syntax: SET variable = value FOR account Created: 2015-03-11  Updated: 2015-10-31

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Federico Razzoli Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-7582 Create the ability to add a default d... Open

 Description   

It would be great if we could have this syntax:

SET variable = value FOR account

The variable should be set immediately when specified user connects.

This would allow us to configure an application's settings without affecting the global behavior. This is useful for closed source applications, and for applications we'd prefer not to touch (for example because we want to be able to upgrade the open source application with a trivial apt-get, or because the maintainer of the application is unreliable).

Of course we'd also need a way to configure this in my.cnf, and a syntax to ask the server the default variables for a given user.

I hope this is possible.



 Comments   
Comment by Sergei Golubchik [ 2015-03-11 ]

Until this is implemented, you can emulate this, I think, with, a stored procedure and --init-connect:

CREATE PROCEDURE autoexec ()
BEGIN
  IF USER() = 'foo@bar' THEN
    SET variable = value;
   ...
 END IF
END

and

--init-connect='call autoexec()'

Generated at Thu Feb 08 07:22:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.