Subject Re: [firebird-support] Views
Author Ann Harrison
Nols Smit wrote:

>I got it working except the Create View statements are missing. For
>example, my view named KPI is only showing the following statements:
>
>SELECT codetable.id, codetable.description
> FROM codetable
> WHERE codetable.codetype_id = 2
>
>Instead of:
>
>CREATE VIEW KPIS ( ID, DESCRIPTION)
> AS SELECT codetable.id, codetable.description
> FROM codetable
> WHERE codetable.codetype_id = 2
>
Firebird stores only the computational part of the view in rdb$view
source. The "create view" part is, in its opinion, syntactic sugar
because the rdb$view_source field "knows" that it's part of a create
view statement. The field lists are normalized and put in the
rdb$relation_fields table. You will find the local name of the field in
rdb$field_name and the name of the field in the source table in
rdb$base_field. The internal context identifier is rdb$view_context.
Use the view name and the context identifier to lookup the source table
in rdb$view_relations.

Regards,


Ann