Skip to content

Commit

Permalink
Merge #39310
Browse files Browse the repository at this point in the history
39310: sql: do not re-create columnFormatCodes if there is a single column. r=mjibson a=elliotcourant

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.

This was just something I had noticed a while after I had already
submitted #38870.

Co-authored-by: Elliot Courant <me@elliotcourant.dev>
  • Loading branch information
craig[bot] and elliotcourant committed Aug 5, 2019
2 parents 6bb1bc5 + 141410c commit 72c45ee
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 72c45ee

Please sign in to comment.