(state: &SharedState, identity: &AuthenticatedIdentity)
| 113 | } |
| 114 | |
| 115 | pub 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 | |
| 141 | pub fn pg_index(state: &SharedState, identity: &AuthenticatedIdentity) -> PgWireResult<VTable> { |
| 142 | let mut t = VTable::new(vec![ |
no test coverage detected