Computed field could be wrongly evaluated as NULL
-------------------------------------------------

                 Key: CORE-6351
                 URL: http://tracker.firebirdsql.org/browse/CORE-6351
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 3.0.6
            Reporter: Vlad Khorsun


The sample is based on much more complex case sent to me by user privately.

1. Prepare metatada

create table t1
(
  id int,
  f1 computed by ('abcd'),
  f2 computed by ('xyz')
);
commit;

set term ^;
create or alter procedure p_t1 (id int)
  returns (val varchar(32))
as
begin
  val = 'unknown';

  select f2 from t1 where id = :id
    into :val;

  suspend;
end^
set term ;^
commit;

alter table t1
  alter f1 computed by ((select val from p_t1(id)));

alter table t1
  alter f2 computed by ('id = ' || id);
commit;

insert into t1 values (1);
commit;
exit;



2. Test OK

select val from p_t1(1);

VAL
================================
id = 1

select * from t1;

          ID F1                               F2
============ ================================ ================
           1 id = 1                           id = 1

exit;


3. Test FAIL

select * from t1;

          ID F1                               F2
============ ================================ ================
           1 <null>                           id = 1

select val from p_t1(1);

VAL
================================
<null>

exit;


The issue happens when:
- table contains at least two caclulated fields
- first calc field contains expression with PSQL object which used second calc 
field
- the table metadata is loaded into metadata cache before metadata of PSQL 
object mentioned above


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to