Issue Details (XML | Word | Printable)

Key: CORE-4117
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dmitry Yemanov
Reporter: GR
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

COMPUTED BY field is evaluated as NULL if used as an exception parameter directly

Created: 14/Jun/13 07:35 PM   Updated: 01/Jun/15 06:12 PM
Component/s: Engine
Affects Version/s: 2.1.0, 2.1.1, 2.0.5, 2.1.2, 2.1.3, 2.0.6, 2.5.0, 2.1.4, 2.5.1, 2.0.7, 2.1.5, 2.5.2, 2.1.5 Update 1, 2.5.2 Update 1
Fix Version/s: 2.1.6, 2.5.3

Issue Links:
Relate
 

QA Status: Done successfully
Test Details:
Confirmed wrong output in 2.5.2: no value between
"-EX_BAD_COMPUTED_FIELD_VALUE"
and
"At trigger 'TEST1_BU' line: ***, col: ***"


 Description  « Hide
CREATE TABLE TEST (
    ID INTEGER NOT NULL,
    C COMPUTED BY (id * 10)
);

CREATE EXCEPTION EX 'TEXT ';

INSERT INTO TEST(ID)
VALUES (1);

COMMIT;

1. Exception with computed by field as parameter

CREATE OR ALTER TRIGGER TEST_TR FOR TEST
ACTIVE BEFORE UPDATE POSITION 0
as
begin
  exception ex new.c;
end

update TEST
set id = 2;

-- returns error without field value

EX.
TEXT .
At trigger 'TEST_TR' line: 5, col: 3.

2. Exception with computed by field as a part of expression

CREATE OR ALTER TRIGGER TEST_TR FOR TEST
ACTIVE BEFORE UPDATE POSITION 0
as
begin
  exception ex new.c + 0; -- any expression
end

update TEST
set id = 2;

-- returns correct error with field value

EX.
20.
At trigger 'TEST_TR' line: 5, col: 3.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Sean Leyne added a comment - 14/Jun/13 07:52 PM
I don't see how OLD or NEW context references to COMPUTED fields should be valid -- it just seems wrong.

arni added a comment - 15/Jun/13 04:24 AM
Both OLD and NEW contexts work fine for computed fields.
Problem starts when computed field uses in simplest expression, as argument of exception e.g.
In this case value of new.c is not evaluated:

exception ex new.c;

Dmitry Yemanov added a comment - 15/Jun/13 06:12 AM
Fixed in v2.1 and v2.5 branches, v3.0 is not affected.