MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / pg_attribute

Function pg_attribute

nodedb/src/control/server/pgwire/pg_catalog/tables.rs:115–139  ·  view source on GitHub ↗
(state: &SharedState, identity: &AuthenticatedIdentity)

Source from the content-addressed store, hash-verified

113}
114
115pub fn pg_attribute(state: &SharedState, identity: &AuthenticatedIdentity) -> PgWireResult<VTable> {
116 let mut t = VTable::new(vec![
117 VColumn::new("attrelid", VType::Int8),
118 VColumn::new("attname", VType::Text),
119 VColumn::new("atttypid", VType::Int8),
120 VColumn::new("attnum", VType::Int4),
121 VColumn::new("attlen", VType::Int4),
122 VColumn::new("attnotnull", VType::Bool),
123 ]);
124 for coll in load_collections(state, identity) {
125 let rel_oid = stable_collection_oid(coll.tenant_id, &coll.name);
126 for (col_num, (field_name, field_type)) in coll.fields.iter().enumerate() {
127 let type_oid = field_type_to_oid(field_type);
128 t.push(vec![
129 VValue::Int8(rel_oid),
130 VValue::Text(field_name.clone()),
131 VValue::Int8(type_oid),
132 VValue::Int4((col_num + 1) as i32),
133 VValue::Int4(-1),
134 VValue::Bool(false),
135 ]);
136 }
137 }
138 Ok(t)
139}
140
141pub fn pg_index(state: &SharedState, identity: &AuthenticatedIdentity) -> PgWireResult<VTable> {
142 let mut t = VTable::new(vec![

Callers 1

evaluateFunction · 0.85

Calls 5

load_collectionsFunction · 0.85
stable_collection_oidFunction · 0.85
field_type_to_oidFunction · 0.85
iterMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected