Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with brackets for EXECUTE PROCEDURE [CORE6277] #6519

Closed
firebird-automations opened this issue Apr 7, 2020 · 4 comments
Closed

Problem with brackets for EXECUTE PROCEDURE [CORE6277] #6519

firebird-automations opened this issue Apr 7, 2020 · 4 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Maxim Kuzmin (cybermax)

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;

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

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.

@firebird-automations
Copy link
Collaborator Author

Commented by: Maxim Kuzmin (cybermax)

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.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

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.

@firebird-automations
Copy link
Collaborator Author

Commented by: Maxim Kuzmin (cybermax)

What if using option in firebird.conf, as in the case RelaxedAliasChecking?
Perhaps, the number of databases using this feature is small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants