(
desc: &RelationDesc,
formats: &[mz_pgwire_common::Format],
)
| 93 | } |
| 94 | |
| 95 | pub fn encode_row_description( |
| 96 | desc: &RelationDesc, |
| 97 | formats: &[mz_pgwire_common::Format], |
| 98 | ) -> Vec<FieldDescription> { |
| 99 | desc.iter() |
| 100 | .zip_eq(formats) |
| 101 | .map(|((name, typ), format)| { |
| 102 | let pg_type = mz_pgrepr::Type::from(&typ.scalar_type); |
| 103 | FieldDescription { |
| 104 | name: name.clone(), |
| 105 | table_id: 0, |
| 106 | column_id: 0, |
| 107 | type_oid: pg_type.oid(), |
| 108 | type_len: pg_type.typlen(), |
| 109 | type_mod: pg_type.typmod(), |
| 110 | format: *format, |
| 111 | } |
| 112 | }) |
| 113 | .collect() |
| 114 | } |