You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Brian Dayhoff (JIRA)" <ji...@apache.org> on 2019/03/18 16:33:00 UTC

[jira] [Created] (NETBEANS-2273) Default mysql delimiter when editing stored procedures breaks procedures

Brian Dayhoff created NETBEANS-2273:
---------------------------------------

             Summary: Default mysql delimiter when editing stored procedures breaks procedures
                 Key: NETBEANS-2273
                 URL: https://issues.apache.org/jira/browse/NETBEANS-2273
             Project: NetBeans
          Issue Type: Bug
          Components: db - MySQL
    Affects Versions: 9.0, 8.2, Next
         Environment: Any version of netbeans with any version of mysql
            Reporter: Brian Dayhoff


Summary:

The default delimiter used when selecting `edit` on a stored procedure is `@@`. This is unsafe, because this string is used natively in mysql to select session variables (and occasionally global variables). Any stored procedure that works with session variables using the typical shorthand `select @@session.varname` breaks when re-inserting the stored procedure as is, because netbeans inserts `DELIMITER @@` at the beginning automatically, and further instances of `@@` as delimiters to close the stored procedure. This should be changed to `$$`, which has no native sql functionality.

 

Steps to reproduce:

 

Create a simple stored procedure that references a session value:

```

DELIMITER $$

DROP PROCEDURE IF EXISTS test $$

CREATE PROCEDURE test ()

proc:begin

SELECT @@session.group_concat_max_len;

END $$

DELIMITER ;

```

 

Run it:

```

CALL test(); – Runs clean

```

 

Select `edit` from the dropdown menu in services referencing the mysql database:

services > Databases > test_database > Procedures > test > edit

 

Run the provided stored procedure without editing anything.

 

Run the procedure again:

```

CALL test(); – broken.

```



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists