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

Provide location context (line/column numbers) for runtime errors raised inside EXECUTE BLOCK [CORE5216] #5496

Closed
firebird-issue-importer opened this issue Apr 28, 2016 · 14 comments

Comments

@firebird-issue-importer

Submitted by: Boltik Evgeny (bolt)

set term ^;

select cast('' as timestamp) from rdb$database
^
-- ERROR:
-- Statement failed, SQLSTATE = 22018
-- conversion error from string ""

recreate procedure qwe123
returns(res timestamp)
as
begin
res = cast('' as timestamp);
suspend;
end
^

execute procedure qwe123
^
-- ERROR:
-- Statement failed, SQLSTATE = 22018
-- conversion error from string ""
-- At procedure 'QWE123' line: 5, col: 3

execute block
returns(res timestamp)
as
begin
res = cast('' as timestamp);
suspend;
end
^
-- ERROR:
-- Statement failed, SQLSTATE = 22018
-- conversion error from string ""

Something like "At anonymous block line: 5, col: 3" should be reported in this case.

Commits: 83bf8f4 1d2eed6 25313da FirebirdSQL/fbt-repository@1df2843 FirebirdSQL/fbt-repository@08d97b2 FirebirdSQL/fbt-repository@f9e0603 FirebirdSQL/fbt-repository@9a371b4 FirebirdSQL/fbt-repository@dbc835d FirebirdSQL/fbt-repository@51da852 FirebirdSQL/fbt-repository@61b4df7 FirebirdSQL/fbt-repository@1d77efa FirebirdSQL/fbt-repository@2ce70a5 FirebirdSQL/fbt-repository@d7e96b9 FirebirdSQL/fbt-repository@0d087a5 FirebirdSQL/fbt-repository@1bdd293 FirebirdSQL/fbt-repository@5fd04e1 FirebirdSQL/fbt-repository@41423ff FirebirdSQL/fbt-repository@60b63a9 FirebirdSQL/fbt-repository@0211556 FirebirdSQL/fbt-repository@3f69053 FirebirdSQL/fbt-repository@fd62429 FirebirdSQL/fbt-repository@ef60cda FirebirdSQL/fbt-repository@2775aef FirebirdSQL/fbt-repository@b5278dc FirebirdSQL/fbt-repository@a0457c3 FirebirdSQL/fbt-repository@25f8bcf FirebirdSQL/fbt-repository@5cb38d3 FirebirdSQL/fbt-repository@14ceb75 FirebirdSQL/fbt-repository@d034aed FirebirdSQL/fbt-repository@3f34dba FirebirdSQL/fbt-repository@9c5ba19

====== Test Details ======

Implemented only for 3.0 and above; 2.5.x does not show all of expected lines.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 28, 2016

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 28, 2016

Commented by: @asfernandes

It's funny that:

- conversion error from string "" -> string denoted with double quotes is wrong

- At procedure 'QWE123' -> metadata name denoted with single quotes is wrong

Nothing to do with this ticket, but... :D

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 28, 2016

Commented by: @dyemanov

It's easy to fix the latter one (single quotes for metadata) but I'm afraid this will break a lot of existing tests for no real value.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 28, 2016

Modified by: @dyemanov

reporter: Dmitry Yemanov [ dimitr ] => Boltik Evgeny [ bolt ]

Fix Version: 3.0.1 [ 10730 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 28, 2016

Commented by: @asfernandes

The later one is bigger than appear, for example, one could not know if 'X.Z' is "X.Z" by the user or Z from package X.

So a correct fix would remove que quotes from the message and put then in the error arguments:
"X.Z" (standalone procedure)
"X"."Z" (packaged procedure)

Surely it could break applications, but today one depending on how we report is already possibly broken.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 28, 2016

Modified by: @dyemanov

priority: Major [ 3 ] => Minor [ 4 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 28, 2016

Commented by: @dyemanov

It could be worth backporting to v2.5, but I leave it for another day.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 28, 2016

Modified by: @dyemanov

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

resolution: Fixed [ 1 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 28, 2016

Commented by: Sean Leyne (seanleyne)

Dmitry,

Rather than "At anonymous block line: 5, col: 3" would suggest simply "At block line: 5, col: 3", "anonymous" could confuse users.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 28, 2016

Commented by: @dyemanov

OK, I will adjust the wording a bit later.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 28, 2016

Modified by: @dyemanov

Fix Version: 2.5.6 [ 10721 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 29, 2016

Commented by: @pavel-zotov

> Fix Version/s: 2.5.6, 3.0.1, 4.0 Alpha 1

For 2.5.6 one may to find that fix is incompleted.
Consider script (based on test for core-2140):

set echo on;

set term ^ ;
execute block
returns \(y int\) as
begin
  for execute statement
      \('select rdb$relation\_id from rdb$database where rdb$relation\_id = :x'\) \(1\)
    with autonomous transaction
    into y
  do suspend;
end 
^


execute block returns \(y int\) as
begin
  select rdb$relation\_id from rdb$database where rdb$relation\_id = :x into y;
end 
^

execute block
returns \(y int\) as
begin
  for execute statement
      \('select rdb$relation\_id from rdb$database where rdb$relation\_id = :x'\) \(3\)
    with autonomous transaction
    into y
  do suspend;
end 
^

execute block returns \(y int\) as
begin
  foo = bar;
end 
^

===

Save it to file 'c2140.sql' and then:

C:\MIX\firebird\fb25\bin\isql /3255:e25 -z -i c2140.sql 1>c2140-25.log 2>&1
C:\MIX\firebird\fb30\isql.exe /3333:e30 -z -i c2140.sql 1>c2140-30.log 2>&1
fc /n /w c2140-25.log c2140-30.log

Result will be:

***** c2140-25.log
25: -X
26: -At line 1, column 67
27: At line 4 in file c2140.sql
***** C2140-30.LOG
25: -X
26: -At line 1, column 66
27: -At block line: 4, col: 7 <<<<<<<<<<<<<<<<<<<<<<<< !!! <<<<<<<<<<<<<<
28: At line 4 in file c2140.sql
*****

***** c2140-25.log
39: -X
40: -At line 3, column 73
41: At line 16 in file c2140.sql
***** C2140-30.LOG
40: -X
41: -At line 3, column 72
42: At line 16 in file c2140.sql
*****

***** c2140-25.log
60: -X
61: -At line 1, column 67
62: At line 21 in file c2140.sql
***** C2140-30.LOG
61: -X
62: -At line 1, column 66
63: -At block line: 4, col: 7 <<<<<<<<<<<<<<<<<<<<<<<< !!! <<<<<<<<<<<<<<
64: At line 21 in file c2140.sql
*****

So, we can see that
1) columns differ
2) line " -At block line: 4, col: 7 " could be missed in 2.5.6

Checked on:

ISQL Version: WI-V2.5.6.27004 Firebird 2.5
Server version:
WI-V2.5.6.27004 Firebird 2.5
WI-V2.5.6.27004 Firebird 2.5/tcp (csprog)/P12
WI-V2.5.6.27004 Firebird 2.5/tcp (csprog)/P12

ISQL Version: WI-V3.0.0.32499 Firebird 3.0
Server version:
WI-V3.0.0.32499 Firebird 3.0
WI-V3.0.0.32499 Firebird 3.0/tcp (csprog)/P13
WI-V3.0.0.32499 Firebird 3.0/tcp (csprog)/P13

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 30, 2016

Modified by: @pavel-zotov

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

QA Status: No test => Deferred

Test Details: Waiting for reply on issue 29/Apr/16 07:34 PM.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 22, 2016

Modified by: @pavel-zotov

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

QA Status: Deferred => Done with caveats

Test Details: Waiting for reply on issue 29/Apr/16 07:34 PM. => Implemented only for 3.0 and above; 2.5.x does not show all of expected lines.

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

Successfully merging a pull request may close this issue.

None yet
2 participants