Description
Submitted by: Valdir Stiebe Junior (ogecrom)
Votes: 2
Every RDB$FIELDS.RDB$COMPUTED_SOURCE are null except for the ones from table computed fields.
Views with subqueries or expressions as fields should also have the correct computed source.
I've found this because I would like to pinpoint fields from views and try to execute statement the view source with only selected fields.
This is the sql query I was trying to build.
select
RF.RDB$FIELD_POSITION,
coalesce(trim(VR.RDB$CONTEXT_NAME) || '.' || trim(RF.RDB$BASE_FIELD), F.RDB$COMPUTED_SOURCE)
from
RDB$RELATION_FIELDS RF left join
RDB$VIEW_RELATIONS VR on RF.RDB$RELATION_NAME = VR.RDB$VIEW_NAME and RF.RDB$VIEW_CONTEXT = VR.RDB$VIEW_CONTEXT left join
RDB$FIELDS F on F.RDB$FIELD_NAME = RF.RDB$FIELD_SOURCE
where
RF.RDB$RELATION_NAME = 'VIEW_NAME'
order by
RF.RDB$FIELD_POSITION