Skip to content

Commit 54ea9f3

Browse files
committed
Don't modify the format of columns in a SimpleQuery
1 parent 7bad3ce commit 54ea9f3

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

Sources/PostgresNIO/New/Connection State Machine/SimpleQueryStateMachine.swift

+2-11
Original file line numberDiff line numberDiff line change
@@ -108,23 +108,14 @@ struct SimpleQueryStateMachine {
108108
return self.setAndFireError(.unexpectedBackendMessage(.rowDescription(rowDescription)))
109109
}
110110

111-
// In Postgres extended queries we always request the response rows to be returned in
112-
// `.binary` format.
113-
// However, this is a simple query and almost all responses will be in text format anyway.
114-
let columns = rowDescription.columns.map { column -> RowDescription.Column in
115-
var column = column
116-
// FIXME: .binary is not valid in a simple-query
117-
column.format = .binary
118-
return column
119-
}
120-
121111
guard !self.isCancelled else {
122112
self.state = .drain(rowDescription.columns)
123113
return .failQuery(queryContext.promise, with: .queryCancelled)
124114
}
125115

126116
self.avoidingStateMachineCoW { state in
127-
state = .rowDescriptionReceived(queryContext, columns)
117+
// In a simple query almost all responses/columns will be in text format.
118+
state = .rowDescriptionReceived(queryContext, rowDescription.columns)
128119
}
129120

130121
return .wait

0 commit comments

Comments
 (0)