Issue Details (XML | Word | Printable)

Key: CORE-6277
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Maxim Kuzmin
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Problem with brackets for EXECUTE PROCEDURE

Created: 07/Apr/20 03:24 AM   Updated: 07/Apr/20 06:10 AM
Component/s: None
Affects Version/s: 3.0.5
Fix Version/s: None

QA Status: No test


 Description  « Hide
CREATE OR ALTER PROCEDURE TEST_SP (
    PARAM1 INTEGER,
    PARAM2 INTEGER,
    PARAM3 INTEGER)
AS
BEGIN
END

Normal executing is:
EXECUTE PROCEDURE TEST_SP(1, 1, 0);
But FB allow executing with error in the brackets, like this:
EXECUTE PROCEDURE TEST_SP(1), 1, 0;

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dmitry Yemanov added a comment - 07/Apr/20 04:12 AM - edited
This is not a bug. Parenthesis around the argument list are optional:

EXECUTE PROCEDURE TEST_SP 1, 1, 0 -- also works

but parenthesis may also be an optional part of the expression:

1 == (1) == (1+0), this is why this is also a valid syntax:

EXECUTE PROCEDURE TEST_SP ((1), (1), (0))
as well as:
EXECUTE PROCEDURE TEST_SP (1), (1), (0)
or, in your example:
EXECUTE PROCEDURE TEST_SP (1), 1, 0

This may look weird but it's correct.

Maxim Kuzmin added a comment - 07/Apr/20 05:32 AM
SELECT * FROM TEST_SP 1, 1, 0
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 1, column 23.
1.

Are parenthesis required here?

P.S. Optional parenthesis leads to errors in writing query. I stepped on this several times.

Dmitry Yemanov added a comment - 07/Apr/20 05:47 AM
I was speaking about EXECUTE PROCEDURE. SELECT FROM PROCEDURE has different grammar rules and parenthesis are mandatory there.

> Optional parenthesis leads to errors in writing query. I stepped on this several times.

Perhaps. And personally I'd prefer parenthesis to be mandatory in all cases. But I can easily imagine users writing arguments without parenthesis just because "it was always allowed". And I doubt we should break them without strong reasons.

Maxim Kuzmin added a comment - 07/Apr/20 06:10 AM
What if using option in firebird.conf, as in the case RelaxedAliasChecking?
Perhaps, the number of databases using this feature is small.