Issue Details (XML | Word | Printable)

Key: CORE-6179
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Valdir Stiebe Junior
Votes: 2
Watchers: 5
Operations

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

Fill RDB$FIELDS.RDB$COMPUTED_SOURCE for view fields

Created: 01/Nov/19 06:56 PM   Updated: 02/Nov/19 05:40 AM
Component/s: Engine
Affects Version/s: 3.0.3, 3.0.4, 2.5.9
Fix Version/s: None

QA Status: No test


 Description  « Hide
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




 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
F.D.Castel added a comment - 01/Nov/19 11:44 PM
I did like the idea of having access to the view column source. However, I don't know if RDB$COMPUTED_SOURCE would be the best place for it.

Alternative suggestion: to add a new RDB$VIEW_SOURCE column into RDB$FIELDS. Only used for view fields.

This way we could keep the RDB$COMPUTED_SOURCE and RDB$COMPUTED_BLR fields just for COMPUTED BY fields.

Dmitry Yemanov added a comment - 02/Nov/19 05:40 AM
System tables are for the engine to operate and for extracting the source code as DDL. These tasks work fine without this new feature. So far I don't see any good rationale why this is necessary.