sfackler / rust-postgres

Native PostgreSQL driver for the Rust programming language
Apache License 2.0
3.52k stars 446 forks source link

Idea: Add RowDescription to SimpleQueryMessage #1143

Closed rigby-dane closed 4 months ago

rigby-dane commented 6 months ago

Currently when processing the SimpleQueryMessage, if there are no DataRows coming from postgres the column data is inaccessible since the data is embedded in the SimpleQueryRow. In particular, this makes it difficult if you're displaying user submitted or dynamic query results where being able to determine the columns from the query after it's been sent to the server would be useful. Adding an enum value of RowDescription(Arc<[SimpleColumn]>) would alleviate this since you could separately process the columns even without a DataRow being returned.

sfackler commented 6 months ago

Seems reasonable to me. SimpleQueryMessage is already marked non_exhaustive so this should be a backwards compatible change.