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

Parameterized exception: wrong output when number of arguments greater than 7 [CORE4755] #5059

Closed
firebird-issue-importer opened this issue Apr 19, 2015 · 9 comments

Comments

@firebird-issue-importer

Submitted by: @pavel-zotov

Attachments:
gen_exc.zip

The following batch generates .sql with declaration of exception that accepts arbitrary number of arguments (defined as %1 for this batch) and also it adds EXECUTE BLOCK for testing such exception.
For example, if this batch is called like this:

C:\> gen_exc.bat 3

-- it will create .sql with text:

recreate exception ex_surprised 'OMG... Look what I''ve got:
@1
@2
@3
';
commit;
set term ^;
execute block as
declare v_1 int = 12346;
declare v_2 int = 12347;
declare v_3 int = 12348;
begin
exception ex_surprised using(
v_1
,v_2
,v_3
);
end
^
set term ;^

This .sql will output in STDERR:

Statement failed, SQLSTATE = HY000
exception 12
-EX_SURPRISED
-OMG... Look what I've got:
12346
12347
12348

When I call this batch with argument = 165 the following output will be produced:
Statement failed, SQLSTATE = HY000
exception 13
-EX_SURPRISED
-OMG... Look what I've got:
12346
12347
12348
12349
12350
12351
12352
@8
@9
123460
123461
. . .
123528
123529
@80
@81
@82
@83
@84
@85
@86
@87
@88
@89
@90
@91
@92
@93
@94
@95
@96
@97
@98
@99
1234600
1234601
. . .
1234643
1234644
1234645
123464...

(see attached file).

So, the questions are:
1) what is the maximum of arguments to parametrized exception ?
2) if no upper limit is defined then how this output can be explained:
2.1) @8, @9 and @80 ... @99 instead of actual values;
2.2) values after '@9' are 10 times larger, values after @99 are 100 times larger than proper;
2.3) values after 163th argument aren't displayed.

WI-T3.0.0.31794

Commits: dd2411e FirebirdSQL/fbt-repository@35ec1ff

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 19, 2015

Modified by: @pavel-zotov

Attachment: gen_exc.zip [ 12710 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 20, 2015

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 29, 2015

Commented by: @asfernandes

Maximum number of arguments was @7. I increased to 9.

That in mind, there were no bug. @10 is just @1 followed by a literal 0.

I'm now rejecting argument list with more than 9 parameters in compile time.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 29, 2015

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Beta 2 [ 10586 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 29, 2015

Commented by: @pavel-zotov

> I'm now rejecting argument list with more than 9 parameters in compile time.

IMHO, it will be nice if doc/readme.*.txt will reflect this limitation.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 29, 2015

Commented by: @asfernandes

Yep, look at it.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 30, 2015

Commented by: @sim1984

> Notes:
> The maximum number of arguments passed is 10.

> In the exception message, @nn (example: @10) is considered as @1 followed by the literal 0.

Here is the error. Second sentence (and also the code) that the maximum number of arguments to 9 instead of 10.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 30, 2015

Commented by: @asfernandes

Thanks.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 28, 2015

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Done successfully

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