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

execute statement ignores the text of the SQL-query after a comment of the form "-" [CORE5783] #6046

Closed
firebird-issue-importer opened this issue Mar 29, 2018 · 6 comments

Comments

@firebird-issue-importer

Submitted by: Polesov (polesov)

If the text of the SQL query executed in the execute statement contains comments "-", then starting with the "-" characters, all text is ignored to the end.

For example:

create or alter procedure STMT_ERR
returns (
LEN integer,
NAME varchar(100))
as
declare variable SQL blob;
begin
SQL =
'select RDB$FIELD_LENGTH, RDB$FIELD_NAME
from RDB$FIELDS
where not RDB$FIELD_NAME is null
-- comment
and RDB$FIELD_LENGTH > 2
order by RDB$FIELD_LENGTH
';

for
execute statement ( :SQL )
into :LEN, :NAME
do
suspend;
end

Commits: a9b8442

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 29, 2018

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 30, 2018

Commented by: @hvlad

The issue have 3 parts:

a) when EXEC STMT get SQL query text from binary BLOB variable (as in this test case), engine uses special blob filter to convert binary blob to text (filter_text).
I don't know why, but this blob filter uses \n (new-line) as segment boundary and *removes* it from output !
Thus EXEC STMT got SQL query text with plain \r as line endings (if there was \r\n stored at blob - as in this case)

Correspondingly, there is a simple workaround - use BLOB SUB_TYPE TEXT (or VARCHAR) for SQL text.

b) EXEC STMT preprocessor doesn't handle \r as end of line, thus it can't find end of single-line comment

c) same problem exists at DSQL lexer - it also can't handle plain \r as end of line

I going to fix both (b) and (c) but not going to change blob filter at (a)

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 3, 2018

Modified by: @hvlad

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

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

Fix Version: 3.0.4 [ 10863 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 5, 2018

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 5, 2018

Modified by: @pavel-zotov

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

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Apr 7, 2018

Commented by: @ibprovider

I detect your changes in my test system :)

From my point of view - it is problem of "blob filter".

---
Some time ago (~5 years) I asked Alex(?) about support of '\r' as EOL. He said - 'NO'.

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