pub struct ViewEntry {
pub name: String,
pub sql: String,
pub statement: String,
pub aliases: Vec<String>,
pub columns: Vec<Field>,
}Expand description
One view’s line in the catalog directory.
A view has no pages, so unlike a table it is entirely here and there is no second level under it.
What it is made of is text: the body the binder binds again at every reference, and the whole
statement written back out, which is what duckdb_views() reports and nothing else reads.
The columns are a cache and they are written down anyway, which is worth saying out loud because
a cache in a file looks like a mistake. It is what the pin does. Create a view on a file, open
the file again in another process, and duckdb_views() answers column_count and is_bound
true without anything having bound the body, so the list survived the write. Not writing it
would answer null and false there, and the only way back would be to bind every view at open,
which is the thing the cache exists to avoid.
Fields§
§name: StringThe view’s own name, without the schema, the way a table entry holds its name.
sql: StringThe query the view stands for, as the text that was written.
statement: StringThe whole CREATE VIEW written back out.
aliases: Vec<String>The column names the statement gave, which rename a prefix of what the body produces.
columns: Vec<Field>The columns the last bind of the body produced.