maria-discuss team mailing list archive
-
maria-discuss team
-
Mailing list archive
-
Message #05399
Re: install plugin “if not installed”?
Hi, Felipe!
On Mar 29, Felipe Gasper wrote:
> Hello,
>
> Is there any way to install a plugin via SQL but to trap the error
> that comes up if the plugin is already installed?
>
> I’d like to do it without creating a “throwaway” procedure, if that’s
> possible.
Yes. There's more than one way to do it:
* INSTALL PLUGIN IF NOT EXISTS is available since 10.4.0
* INSTALL SONAME doesn't error out if the plugin is installed
* compound statements offer a generic way to avoid a throwaway procedure:
BEGIN NOT ATOMIC
DECLARE EXIT HANDLER FOR 1968 DO 1
INSTALL PLUGIN ...
END
or
IF NOT EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='...') THEN
INSTALL PLUGIN ...;
END IF
Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx
References