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

Regression in FB 4.x : "Unexpected end of command" with incorrect line/column info #6807

Closed
pavel-zotov opened this issue May 12, 2021 · 3 comments

Comments

@pavel-zotov
Copy link

pavel-zotov commented May 12, 2021

Consider following INCORRECT script (it contains wrong token in RETURNUNG clause: "AS" instead of "INTO"):

recreate table test(id int);
insert into test(id) values(null);
set term ^;
execute block as
    declare v_id int;
begin
    update test set id = -id returning id as v_id; -- this is WRONG; "INTO" must be here
end
^
set term ;^

Its output will be:

  1. in FB 2.5:

Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 4, column 43
-as

  1. in FB 3.0.8.33465:

Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Unexpected end of command - line 4, column 40

(looks strange because all commands appear to have tokens of completion; but anyway, we can easy find problem place because of non-zero line/column values)

  1. in FB 4.0.0.2479:

Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Unexpected end of command - line 0, column 0

This output is much worse: we can not find problem place because of zeroes for line/column.

@asfernandes asfernandes self-assigned this May 12, 2021
@asfernandes
Copy link
Member

asfernandes commented May 12, 2021

The AS <name> is supported as alias in SELECT columns now, so the error is correct.

The only problem seems line 0, column 0.

@mrotteveel
Copy link
Member

@asfernandes Did you mean "as alias in RETURNING columns"?

@asfernandes
Copy link
Member

@asfernandes Did you mean "as alias in RETURNING columns"?

Yes. It may be useless in PSQL code, but is also supported there.

@asfernandes asfernandes changed the title Regression in FB 3.x / 4.x : "Unexpected end of command" when 'RETURNING' clause is used incorrectly inside execute block (expected: instead of "Token unknown" + non-zero line/column values) Regression in FB 3.x / 4.x : "Unexpected end of command" with incorrect line/column info May 13, 2021
@asfernandes asfernandes changed the title Regression in FB 3.x / 4.x : "Unexpected end of command" with incorrect line/column info Regression in FB 4.x : "Unexpected end of command" with incorrect line/column info Jun 26, 2022
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

3 participants