Subject Re: [firebird-support] How to determine whether a column is computed?
Author Martijn Tonies
Hello Christian,

> I am trying to determine whether a given column is a COMPUTED BY
> column. As far as I can see, the are several ways to do this.
> The first (and easy) way could be to check whether the
> RDB$COMPUTED_SOURCE field in RDB$FIELDS contains a value (i.e.
> it is not blank/not NULL). This seems to be true for all
> computed columns. But I am not sure if this always works.
> There must be another way to determine this by the use of the
> table RDB$TYPES. There is a column RDB$TYPES.RDB$FIELD_NAME that
> contains the value "RDB$OBJECT_TYPE" and the corresponding field
> RDB$TYPES.TYPE_NAME contains the description "COMPUTED_FIELD".
> So there must be a place where a field is defined as "COMPUTED_FIELD",
> but I cannot find it. I tried to look it up in the IB 6 beta docs,
> but no success. I am sure someone can give me a hint on this ;-)
> For now, I will use the RDB$COMPUTED_SOURCE field. Please tell me
> if this an inappropriate hack.

RDB$COMPUTED_BLR would be a little bit better. :-)

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Upscene Productions
Database development questions? Check the forum!