Search code examples
mysqlphpstormdatagrip

MySQL change delimiter in PhpStorm data editor console window


How to get PhpStorm data editor to recognize DELIMITER \\?

Scenario: I have a console open, and I want to create a function where I have ; defined in the function.

On execution, function create fails on the first line where ; exists.

The query is like so

DELIMITER //
create function blah (datablah varchar(200)) returns tinyint(1)
  BEGIN
   Return tinyintVar;
  END //
DELIMITER ;

This function works as intended too as it is in production and I want to copy it over into a dev DB. This is why I know the error is due to the delimiter.

But this is not the first time I've tried to do this in an open console with another function. When executing this SQL inline in the data editor console, it just doesn't detect or acknowledge the DELIMITER keyword. Even if I just run with Ctrl + Enter on the line with DELIMITER \\ I get the message "nothing to run".

Note: this will work if I have a .sql file and I just execute the file. But current workflow is to highlight the function from live DB, open editor to view the create function code and then Copy + Paste into the open console window I currently have open.

So, is the only way to get the DELIMIER recognized is to execute a .sql file?

PhpStorm 2018.2.2

The error is

[2018-09-05 12:07:33] [42000][1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(19), endPeriod DATETIME(19)) returns tinyint(1)
[2018-09-05 12:07:33] BEGIN
[2018-09-05 12:07:33] DECLARE live BOOLEA' at line 1

screenshot enter image description here

From the screenshot, you'll notice the execute group hasn't put the green box around the delimiter keywords. This is why I think it's not recognizing the keyword.


Solution

  • As there is a Feature request to have it implemented I will say it's not supported.

    DBE-2968: Ability to configure SQL Statement delimiter/terminator