Subject Re: [firebird-support] Getting underlying table
Author Ivan Prenosil
> How can I get the name of the physical table accessed by an Query
> which is running against an view. I'm using the API.
>
> Example
>
> Create Table SampleTable ( ... )
>
> Create View SampleView as Select .. FROM Table ...
>
> I'm running "SELECT * from Sample View"
>
> By looking at "alias_name" I can detect the Views Name "SampleView"
> from the prepared statement. But, I want to know that the data comes
> from "SampleTable".

Either analyze the source code of view (rdb$view_source field in rdb$relations table),
or look at rdb$dependencies table (but it will not distinguish which column
belongs to what table if the view contains join of several tables).

Ivan