Skip to content

Commit

Permalink
Small tweak to not re-create columnFormatCodes if there is a single col.
Browse files Browse the repository at this point in the history
If there is only one column and there is only one format code, then
there is no need to rebuild the list. We would only need to rebuild the
list if there is more than 1 column and only a single format code was
provided by the client.
  • Loading branch information
elliotcourant committed Aug 4, 2019
1 parent 3b9a95b commit 141410c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sql/conn_executor_prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func (ex *connExecutor) execBind(
}

columnFormatCodes := bindCmd.OutFormats
if len(bindCmd.OutFormats) == 1 {
if len(bindCmd.OutFormats) == 1 && numCols > 1 {
// Apply the format code to every column.
columnFormatCodes = make([]pgwirebase.FormatCode, numCols)
for i := 0; i < numCols; i++ {
Expand Down

0 comments on commit 141410c

Please sign in to comment.