@@ -25,6 +25,7 @@ async fn prepare(
25
25
sql : & str ,
26
26
parameters : & [ PgTypeInfo ] ,
27
27
metadata : Option < Arc < PgStatementMetadata > > ,
28
+ fetch_column_origin : bool ,
28
29
) -> Result < ( StatementId , Arc < PgStatementMetadata > ) , Error > {
29
30
let id = conn. inner . next_statement_id ;
30
31
conn. inner . next_statement_id = id. next ( ) ;
@@ -79,7 +80,7 @@ async fn prepare(
79
80
80
81
let parameters = conn. handle_parameter_description ( parameters) . await ?;
81
82
82
- let ( columns, column_names) = conn. handle_row_description ( rows, true ) . await ?;
83
+ let ( columns, column_names) = conn. handle_row_description ( rows, true , fetch_column_origin ) . await ?;
83
84
84
85
// ensure that if we did fetch custom data, we wait until we are fully ready before
85
86
// continuing
@@ -168,12 +169,13 @@ impl PgConnection {
168
169
// optional metadata that was provided by the user, this means they are reusing
169
170
// a statement object
170
171
metadata : Option < Arc < PgStatementMetadata > > ,
172
+ fetch_column_origin : bool ,
171
173
) -> Result < ( StatementId , Arc < PgStatementMetadata > ) , Error > {
172
174
if let Some ( statement) = self . inner . cache_statement . get_mut ( sql) {
173
175
return Ok ( ( * statement) . clone ( ) ) ;
174
176
}
175
177
176
- let statement = prepare ( self , sql, parameters, metadata) . await ?;
178
+ let statement = prepare ( self , sql, parameters, metadata, fetch_column_origin ) . await ?;
177
179
178
180
if store_to_cache && self . inner . cache_statement . is_enabled ( ) {
179
181
if let Some ( ( id, _) ) = self . inner . cache_statement . insert ( sql, statement. clone ( ) ) {
@@ -222,7 +224,7 @@ impl PgConnection {
222
224
// prepare the statement if this our first time executing it
223
225
// always return the statement ID here
224
226
let ( statement, metadata_) = self
225
- . get_or_prepare ( query, & arguments. types , persistent, metadata_opt)
227
+ . get_or_prepare ( query, & arguments. types , persistent, metadata_opt, false )
226
228
. await ?;
227
229
228
230
metadata = metadata_;
@@ -327,7 +329,7 @@ impl PgConnection {
327
329
BackendMessageFormat :: RowDescription => {
328
330
// indicates that a *new* set of rows are about to be returned
329
331
let ( columns, column_names) = self
330
- . handle_row_description( Some ( message. decode( ) ?) , false )
332
+ . handle_row_description( Some ( message. decode( ) ?) , false , false )
331
333
. await ?;
332
334
333
335
metadata = Arc :: new( PgStatementMetadata {
@@ -449,7 +451,7 @@ impl<'c> Executor<'c> for &'c mut PgConnection {
449
451
Box :: pin ( async move {
450
452
self . wait_until_ready ( ) . await ?;
451
453
452
- let ( _, metadata) = self . get_or_prepare ( sql, parameters, true , None ) . await ?;
454
+ let ( _, metadata) = self . get_or_prepare ( sql, parameters, true , None , true ) . await ?;
453
455
454
456
Ok ( PgStatement {
455
457
sql : Cow :: Borrowed ( sql) ,
@@ -468,7 +470,7 @@ impl<'c> Executor<'c> for &'c mut PgConnection {
468
470
Box :: pin ( async move {
469
471
self . wait_until_ready ( ) . await ?;
470
472
471
- let ( stmt_id, metadata) = self . get_or_prepare ( sql, & [ ] , true , None ) . await ?;
473
+ let ( stmt_id, metadata) = self . get_or_prepare ( sql, & [ ] , true , None , true ) . await ?;
472
474
473
475
let nullable = self . get_nullable_for_columns ( stmt_id, & metadata) . await ?;
474
476
0 commit comments