pub struct Field {
pub column: Column,
pub of: Option<Arc<str>>,
}Expand description
One column of the rows a query produced, and the table name a reference may qualify it with.
A Column is what goes on the wire; this is what a where, an order by and a select list
resolve a name against. The two are separate because a joined row has columns from several
tables and two of them may share a name — which is a question about the query rather than
about the wire, where a column is a name and a type OID and nothing else.
Fields§
§column: Column§of: Option<Arc<str>>The table this came from, as this query knows it. None for a computed column — an
aggregate, a literal, or anything given an alias, none of which a qualified name may reach.
Implementations§
Source§impl Field
impl Field
Sourcepub fn of_table(t: &Table) -> Vec<Field>
pub fn of_table(t: &Table) -> Vec<Field>
A base table’s own columns, which is what a query over one table resolves against.
Sourcepub fn of_table_as(t: &Table, alias: Arc<str>) -> Vec<Field>
pub fn of_table_as(t: &Table, alias: Arc<str>) -> Vec<Field>
The same, under the name the query calls the table.
A qualified reference names the alias — from pg_attribute a … where a.attnum > 0 — so a
query over one table has to resolve names against the alias exactly as a join does. One
rule, in both places, because a name that resolved one way in a scan and another in a join
would be two.