Copilot commented on code in PR #4687:
URL: https://github.com/apache/arrow-adbc/pull/4687#discussion_r3793548046


##########
c/driver/postgresql/result_reader.cc:
##########
@@ -203,9 +203,9 @@ Status PqResultArrayReader::Initialize(int64_t* 
rows_affected) {
     UNWRAP_ERRNO(Internal,
                  type_resolver_->FindWithDefault(helper_.FieldType(i), 
&child_type));
 
-    UNWRAP_ERRNO(Internal, child_type.SetSchema(schema_->children[i], 
vendor_name_));
     UNWRAP_ERRNO(Internal,
                  ArrowSchemaSetName(schema_->children[i], 
helper_.FieldName(i)));
+    UNWRAP_ERRNO(Internal, child_type.SetSchema(schema_->children[i], 
vendor_name_));

Review Comment:
   `SetSchema()` always calls `ArrowSchemaSetName()` using the `PostgresType`'s 
`field_name_`. Types returned directly by `FindWithDefault()` have no field 
name, so setting the name first here is immediately overwritten with an empty 
string (for example, the existing non-COPY schema assertions in 
`postgresql_test.cc:2515-2518` will fail). Pass the result-column name into the 
type before building the schema; this also ensures record-valued columns 
receive the new metadata instead of being mistaken for the unnamed root record.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to