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: The subquery in the insert list expressions ignore the changes made earlier in the same executable block. [CORE5337] #5613

Closed
firebird-automations opened this issue Aug 24, 2016 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @sim1984

WI-V6.3.0.32483 Firebird 3.0

CREATE TABLE TEST (
ID INTEGER NOT NULL,
VAL INTEGER NOT NULL
);

execute block
as
begin
insert into test (id, val) values (1, 100);
insert into test (id, val) values (2, (select val from test where id = 1));
end

The insert failed because a column definition includes validation constraints.
validation error for column "TEST"."VAL", value "*** null ***".

However, here is a code works without error.

execute block
as
declare v integer;
begin
insert into test (id, val) values (1, 100);
select val from test where id = 1 into :v;
insert into test (id, val) values (2, :v);
end

This ticket is related with CORE3362.

Commits: d5ff6d8 d8f43da

@firebird-automations
Copy link
Collaborator Author

Modified by: @sim1984

summary: Regression: The cursor does not see the changes made earlier in the same executable block. => Regression: The cursor ignore the changes made earlier in the same executable block.

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

summary: Regression: The cursor ignore the changes made earlier in the same executable block. => Regression: The subquery in the insert list expressions ignore the changes made earlier in the same executable block.

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

The issue occurs with the following conditions:
- PSQL block contains a few DML statements
- INSERT or UPDATE OR INSERT statement have subselect in VALUES expressions
- subselect queries table which was changed by some previous DML statement in the same PSQL block

Standalone subqueries are not affected.
INSERT INTO ... SELECT FROM are not affected.
UPDATE, DELETE and MERGE statements are not affected.

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Fix is committed into master (v4).
Fix changes generated BLR code.
So, if affected code present in stored procedure\function\trigger - it should be recompiled to changes have effect.

@firebird-automations
Copy link
Collaborator Author

Commented by: @sim1984

Will this fix ported to 3.0.1?

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

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

resolution: Fixed [ 1 ]

Fix Version: 3.0.1 [ 10730 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

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