github.com/jackc/pgx/v5@v5.5.5/pgtype/integration_benchmark_test.go (about)

     1  package pgtype_test
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/jackc/pgx/v5"
     8  	"github.com/jackc/pgx/v5/pgtype"
     9  )
    10  
    11  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int16_1_rows_1_columns(b *testing.B) {
    12  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
    13  		b.ResetTimer()
    14  		var v [1]int16
    15  		for i := 0; i < b.N; i++ {
    16  			rows, _ := conn.Query(
    17  				ctx,
    18  				`select n::int4 + 0 from generate_series(1, 1) n`,
    19  				pgx.QueryResultFormats{pgx.TextFormatCode},
    20  			)
    21  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
    22  			if err != nil {
    23  				b.Fatal(err)
    24  			}
    25  		}
    26  	})
    27  }
    28  
    29  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int16_1_rows_1_columns(b *testing.B) {
    30  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
    31  		b.ResetTimer()
    32  		var v [1]int16
    33  		for i := 0; i < b.N; i++ {
    34  			rows, _ := conn.Query(
    35  				ctx,
    36  				`select n::int4 + 0 from generate_series(1, 1) n`,
    37  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
    38  			)
    39  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
    40  			if err != nil {
    41  				b.Fatal(err)
    42  			}
    43  		}
    44  	})
    45  }
    46  
    47  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int16_1_rows_10_columns(b *testing.B) {
    48  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
    49  		b.ResetTimer()
    50  		var v [10]int16
    51  		for i := 0; i < b.N; i++ {
    52  			rows, _ := conn.Query(
    53  				ctx,
    54  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 1) n`,
    55  				pgx.QueryResultFormats{pgx.TextFormatCode},
    56  			)
    57  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
    58  			if err != nil {
    59  				b.Fatal(err)
    60  			}
    61  		}
    62  	})
    63  }
    64  
    65  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int16_1_rows_10_columns(b *testing.B) {
    66  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
    67  		b.ResetTimer()
    68  		var v [10]int16
    69  		for i := 0; i < b.N; i++ {
    70  			rows, _ := conn.Query(
    71  				ctx,
    72  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 1) n`,
    73  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
    74  			)
    75  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
    76  			if err != nil {
    77  				b.Fatal(err)
    78  			}
    79  		}
    80  	})
    81  }
    82  
    83  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int16_10_rows_1_columns(b *testing.B) {
    84  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
    85  		b.ResetTimer()
    86  		var v [1]int16
    87  		for i := 0; i < b.N; i++ {
    88  			rows, _ := conn.Query(
    89  				ctx,
    90  				`select n::int4 + 0 from generate_series(1, 10) n`,
    91  				pgx.QueryResultFormats{pgx.TextFormatCode},
    92  			)
    93  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
    94  			if err != nil {
    95  				b.Fatal(err)
    96  			}
    97  		}
    98  	})
    99  }
   100  
   101  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int16_10_rows_1_columns(b *testing.B) {
   102  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   103  		b.ResetTimer()
   104  		var v [1]int16
   105  		for i := 0; i < b.N; i++ {
   106  			rows, _ := conn.Query(
   107  				ctx,
   108  				`select n::int4 + 0 from generate_series(1, 10) n`,
   109  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   110  			)
   111  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   112  			if err != nil {
   113  				b.Fatal(err)
   114  			}
   115  		}
   116  	})
   117  }
   118  
   119  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int16_100_rows_10_columns(b *testing.B) {
   120  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   121  		b.ResetTimer()
   122  		var v [10]int16
   123  		for i := 0; i < b.N; i++ {
   124  			rows, _ := conn.Query(
   125  				ctx,
   126  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 100) n`,
   127  				pgx.QueryResultFormats{pgx.TextFormatCode},
   128  			)
   129  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   130  			if err != nil {
   131  				b.Fatal(err)
   132  			}
   133  		}
   134  	})
   135  }
   136  
   137  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int16_100_rows_10_columns(b *testing.B) {
   138  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   139  		b.ResetTimer()
   140  		var v [10]int16
   141  		for i := 0; i < b.N; i++ {
   142  			rows, _ := conn.Query(
   143  				ctx,
   144  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 100) n`,
   145  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   146  			)
   147  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   148  			if err != nil {
   149  				b.Fatal(err)
   150  			}
   151  		}
   152  	})
   153  }
   154  
   155  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int32_1_rows_1_columns(b *testing.B) {
   156  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   157  		b.ResetTimer()
   158  		var v [1]int32
   159  		for i := 0; i < b.N; i++ {
   160  			rows, _ := conn.Query(
   161  				ctx,
   162  				`select n::int4 + 0 from generate_series(1, 1) n`,
   163  				pgx.QueryResultFormats{pgx.TextFormatCode},
   164  			)
   165  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   166  			if err != nil {
   167  				b.Fatal(err)
   168  			}
   169  		}
   170  	})
   171  }
   172  
   173  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int32_1_rows_1_columns(b *testing.B) {
   174  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   175  		b.ResetTimer()
   176  		var v [1]int32
   177  		for i := 0; i < b.N; i++ {
   178  			rows, _ := conn.Query(
   179  				ctx,
   180  				`select n::int4 + 0 from generate_series(1, 1) n`,
   181  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   182  			)
   183  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   184  			if err != nil {
   185  				b.Fatal(err)
   186  			}
   187  		}
   188  	})
   189  }
   190  
   191  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int32_1_rows_10_columns(b *testing.B) {
   192  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   193  		b.ResetTimer()
   194  		var v [10]int32
   195  		for i := 0; i < b.N; i++ {
   196  			rows, _ := conn.Query(
   197  				ctx,
   198  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 1) n`,
   199  				pgx.QueryResultFormats{pgx.TextFormatCode},
   200  			)
   201  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   202  			if err != nil {
   203  				b.Fatal(err)
   204  			}
   205  		}
   206  	})
   207  }
   208  
   209  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int32_1_rows_10_columns(b *testing.B) {
   210  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   211  		b.ResetTimer()
   212  		var v [10]int32
   213  		for i := 0; i < b.N; i++ {
   214  			rows, _ := conn.Query(
   215  				ctx,
   216  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 1) n`,
   217  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   218  			)
   219  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   220  			if err != nil {
   221  				b.Fatal(err)
   222  			}
   223  		}
   224  	})
   225  }
   226  
   227  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int32_10_rows_1_columns(b *testing.B) {
   228  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   229  		b.ResetTimer()
   230  		var v [1]int32
   231  		for i := 0; i < b.N; i++ {
   232  			rows, _ := conn.Query(
   233  				ctx,
   234  				`select n::int4 + 0 from generate_series(1, 10) n`,
   235  				pgx.QueryResultFormats{pgx.TextFormatCode},
   236  			)
   237  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   238  			if err != nil {
   239  				b.Fatal(err)
   240  			}
   241  		}
   242  	})
   243  }
   244  
   245  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int32_10_rows_1_columns(b *testing.B) {
   246  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   247  		b.ResetTimer()
   248  		var v [1]int32
   249  		for i := 0; i < b.N; i++ {
   250  			rows, _ := conn.Query(
   251  				ctx,
   252  				`select n::int4 + 0 from generate_series(1, 10) n`,
   253  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   254  			)
   255  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   256  			if err != nil {
   257  				b.Fatal(err)
   258  			}
   259  		}
   260  	})
   261  }
   262  
   263  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int32_100_rows_10_columns(b *testing.B) {
   264  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   265  		b.ResetTimer()
   266  		var v [10]int32
   267  		for i := 0; i < b.N; i++ {
   268  			rows, _ := conn.Query(
   269  				ctx,
   270  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 100) n`,
   271  				pgx.QueryResultFormats{pgx.TextFormatCode},
   272  			)
   273  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   274  			if err != nil {
   275  				b.Fatal(err)
   276  			}
   277  		}
   278  	})
   279  }
   280  
   281  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int32_100_rows_10_columns(b *testing.B) {
   282  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   283  		b.ResetTimer()
   284  		var v [10]int32
   285  		for i := 0; i < b.N; i++ {
   286  			rows, _ := conn.Query(
   287  				ctx,
   288  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 100) n`,
   289  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   290  			)
   291  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   292  			if err != nil {
   293  				b.Fatal(err)
   294  			}
   295  		}
   296  	})
   297  }
   298  
   299  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int64_1_rows_1_columns(b *testing.B) {
   300  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   301  		b.ResetTimer()
   302  		var v [1]int64
   303  		for i := 0; i < b.N; i++ {
   304  			rows, _ := conn.Query(
   305  				ctx,
   306  				`select n::int4 + 0 from generate_series(1, 1) n`,
   307  				pgx.QueryResultFormats{pgx.TextFormatCode},
   308  			)
   309  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   310  			if err != nil {
   311  				b.Fatal(err)
   312  			}
   313  		}
   314  	})
   315  }
   316  
   317  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int64_1_rows_1_columns(b *testing.B) {
   318  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   319  		b.ResetTimer()
   320  		var v [1]int64
   321  		for i := 0; i < b.N; i++ {
   322  			rows, _ := conn.Query(
   323  				ctx,
   324  				`select n::int4 + 0 from generate_series(1, 1) n`,
   325  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   326  			)
   327  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   328  			if err != nil {
   329  				b.Fatal(err)
   330  			}
   331  		}
   332  	})
   333  }
   334  
   335  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int64_1_rows_10_columns(b *testing.B) {
   336  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   337  		b.ResetTimer()
   338  		var v [10]int64
   339  		for i := 0; i < b.N; i++ {
   340  			rows, _ := conn.Query(
   341  				ctx,
   342  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 1) n`,
   343  				pgx.QueryResultFormats{pgx.TextFormatCode},
   344  			)
   345  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   346  			if err != nil {
   347  				b.Fatal(err)
   348  			}
   349  		}
   350  	})
   351  }
   352  
   353  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int64_1_rows_10_columns(b *testing.B) {
   354  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   355  		b.ResetTimer()
   356  		var v [10]int64
   357  		for i := 0; i < b.N; i++ {
   358  			rows, _ := conn.Query(
   359  				ctx,
   360  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 1) n`,
   361  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   362  			)
   363  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   364  			if err != nil {
   365  				b.Fatal(err)
   366  			}
   367  		}
   368  	})
   369  }
   370  
   371  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int64_10_rows_1_columns(b *testing.B) {
   372  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   373  		b.ResetTimer()
   374  		var v [1]int64
   375  		for i := 0; i < b.N; i++ {
   376  			rows, _ := conn.Query(
   377  				ctx,
   378  				`select n::int4 + 0 from generate_series(1, 10) n`,
   379  				pgx.QueryResultFormats{pgx.TextFormatCode},
   380  			)
   381  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   382  			if err != nil {
   383  				b.Fatal(err)
   384  			}
   385  		}
   386  	})
   387  }
   388  
   389  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int64_10_rows_1_columns(b *testing.B) {
   390  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   391  		b.ResetTimer()
   392  		var v [1]int64
   393  		for i := 0; i < b.N; i++ {
   394  			rows, _ := conn.Query(
   395  				ctx,
   396  				`select n::int4 + 0 from generate_series(1, 10) n`,
   397  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   398  			)
   399  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   400  			if err != nil {
   401  				b.Fatal(err)
   402  			}
   403  		}
   404  	})
   405  }
   406  
   407  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_int64_100_rows_10_columns(b *testing.B) {
   408  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   409  		b.ResetTimer()
   410  		var v [10]int64
   411  		for i := 0; i < b.N; i++ {
   412  			rows, _ := conn.Query(
   413  				ctx,
   414  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 100) n`,
   415  				pgx.QueryResultFormats{pgx.TextFormatCode},
   416  			)
   417  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   418  			if err != nil {
   419  				b.Fatal(err)
   420  			}
   421  		}
   422  	})
   423  }
   424  
   425  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_int64_100_rows_10_columns(b *testing.B) {
   426  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   427  		b.ResetTimer()
   428  		var v [10]int64
   429  		for i := 0; i < b.N; i++ {
   430  			rows, _ := conn.Query(
   431  				ctx,
   432  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 100) n`,
   433  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   434  			)
   435  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   436  			if err != nil {
   437  				b.Fatal(err)
   438  			}
   439  		}
   440  	})
   441  }
   442  
   443  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_uint64_1_rows_1_columns(b *testing.B) {
   444  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   445  		b.ResetTimer()
   446  		var v [1]uint64
   447  		for i := 0; i < b.N; i++ {
   448  			rows, _ := conn.Query(
   449  				ctx,
   450  				`select n::int4 + 0 from generate_series(1, 1) n`,
   451  				pgx.QueryResultFormats{pgx.TextFormatCode},
   452  			)
   453  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   454  			if err != nil {
   455  				b.Fatal(err)
   456  			}
   457  		}
   458  	})
   459  }
   460  
   461  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_uint64_1_rows_1_columns(b *testing.B) {
   462  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   463  		b.ResetTimer()
   464  		var v [1]uint64
   465  		for i := 0; i < b.N; i++ {
   466  			rows, _ := conn.Query(
   467  				ctx,
   468  				`select n::int4 + 0 from generate_series(1, 1) n`,
   469  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   470  			)
   471  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   472  			if err != nil {
   473  				b.Fatal(err)
   474  			}
   475  		}
   476  	})
   477  }
   478  
   479  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_uint64_1_rows_10_columns(b *testing.B) {
   480  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   481  		b.ResetTimer()
   482  		var v [10]uint64
   483  		for i := 0; i < b.N; i++ {
   484  			rows, _ := conn.Query(
   485  				ctx,
   486  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 1) n`,
   487  				pgx.QueryResultFormats{pgx.TextFormatCode},
   488  			)
   489  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   490  			if err != nil {
   491  				b.Fatal(err)
   492  			}
   493  		}
   494  	})
   495  }
   496  
   497  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_uint64_1_rows_10_columns(b *testing.B) {
   498  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   499  		b.ResetTimer()
   500  		var v [10]uint64
   501  		for i := 0; i < b.N; i++ {
   502  			rows, _ := conn.Query(
   503  				ctx,
   504  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 1) n`,
   505  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   506  			)
   507  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   508  			if err != nil {
   509  				b.Fatal(err)
   510  			}
   511  		}
   512  	})
   513  }
   514  
   515  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_uint64_10_rows_1_columns(b *testing.B) {
   516  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   517  		b.ResetTimer()
   518  		var v [1]uint64
   519  		for i := 0; i < b.N; i++ {
   520  			rows, _ := conn.Query(
   521  				ctx,
   522  				`select n::int4 + 0 from generate_series(1, 10) n`,
   523  				pgx.QueryResultFormats{pgx.TextFormatCode},
   524  			)
   525  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   526  			if err != nil {
   527  				b.Fatal(err)
   528  			}
   529  		}
   530  	})
   531  }
   532  
   533  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_uint64_10_rows_1_columns(b *testing.B) {
   534  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   535  		b.ResetTimer()
   536  		var v [1]uint64
   537  		for i := 0; i < b.N; i++ {
   538  			rows, _ := conn.Query(
   539  				ctx,
   540  				`select n::int4 + 0 from generate_series(1, 10) n`,
   541  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   542  			)
   543  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   544  			if err != nil {
   545  				b.Fatal(err)
   546  			}
   547  		}
   548  	})
   549  }
   550  
   551  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_uint64_100_rows_10_columns(b *testing.B) {
   552  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   553  		b.ResetTimer()
   554  		var v [10]uint64
   555  		for i := 0; i < b.N; i++ {
   556  			rows, _ := conn.Query(
   557  				ctx,
   558  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 100) n`,
   559  				pgx.QueryResultFormats{pgx.TextFormatCode},
   560  			)
   561  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   562  			if err != nil {
   563  				b.Fatal(err)
   564  			}
   565  		}
   566  	})
   567  }
   568  
   569  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_uint64_100_rows_10_columns(b *testing.B) {
   570  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   571  		b.ResetTimer()
   572  		var v [10]uint64
   573  		for i := 0; i < b.N; i++ {
   574  			rows, _ := conn.Query(
   575  				ctx,
   576  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 100) n`,
   577  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   578  			)
   579  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   580  			if err != nil {
   581  				b.Fatal(err)
   582  			}
   583  		}
   584  	})
   585  }
   586  
   587  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_pgtype_Int4_1_rows_1_columns(b *testing.B) {
   588  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   589  		b.ResetTimer()
   590  		var v [1]pgtype.Int4
   591  		for i := 0; i < b.N; i++ {
   592  			rows, _ := conn.Query(
   593  				ctx,
   594  				`select n::int4 + 0 from generate_series(1, 1) n`,
   595  				pgx.QueryResultFormats{pgx.TextFormatCode},
   596  			)
   597  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   598  			if err != nil {
   599  				b.Fatal(err)
   600  			}
   601  		}
   602  	})
   603  }
   604  
   605  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_pgtype_Int4_1_rows_1_columns(b *testing.B) {
   606  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   607  		b.ResetTimer()
   608  		var v [1]pgtype.Int4
   609  		for i := 0; i < b.N; i++ {
   610  			rows, _ := conn.Query(
   611  				ctx,
   612  				`select n::int4 + 0 from generate_series(1, 1) n`,
   613  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   614  			)
   615  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   616  			if err != nil {
   617  				b.Fatal(err)
   618  			}
   619  		}
   620  	})
   621  }
   622  
   623  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_pgtype_Int4_1_rows_10_columns(b *testing.B) {
   624  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   625  		b.ResetTimer()
   626  		var v [10]pgtype.Int4
   627  		for i := 0; i < b.N; i++ {
   628  			rows, _ := conn.Query(
   629  				ctx,
   630  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 1) n`,
   631  				pgx.QueryResultFormats{pgx.TextFormatCode},
   632  			)
   633  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   634  			if err != nil {
   635  				b.Fatal(err)
   636  			}
   637  		}
   638  	})
   639  }
   640  
   641  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_pgtype_Int4_1_rows_10_columns(b *testing.B) {
   642  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   643  		b.ResetTimer()
   644  		var v [10]pgtype.Int4
   645  		for i := 0; i < b.N; i++ {
   646  			rows, _ := conn.Query(
   647  				ctx,
   648  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 1) n`,
   649  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   650  			)
   651  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   652  			if err != nil {
   653  				b.Fatal(err)
   654  			}
   655  		}
   656  	})
   657  }
   658  
   659  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_pgtype_Int4_10_rows_1_columns(b *testing.B) {
   660  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   661  		b.ResetTimer()
   662  		var v [1]pgtype.Int4
   663  		for i := 0; i < b.N; i++ {
   664  			rows, _ := conn.Query(
   665  				ctx,
   666  				`select n::int4 + 0 from generate_series(1, 10) n`,
   667  				pgx.QueryResultFormats{pgx.TextFormatCode},
   668  			)
   669  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   670  			if err != nil {
   671  				b.Fatal(err)
   672  			}
   673  		}
   674  	})
   675  }
   676  
   677  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_pgtype_Int4_10_rows_1_columns(b *testing.B) {
   678  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   679  		b.ResetTimer()
   680  		var v [1]pgtype.Int4
   681  		for i := 0; i < b.N; i++ {
   682  			rows, _ := conn.Query(
   683  				ctx,
   684  				`select n::int4 + 0 from generate_series(1, 10) n`,
   685  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   686  			)
   687  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   688  			if err != nil {
   689  				b.Fatal(err)
   690  			}
   691  		}
   692  	})
   693  }
   694  
   695  func BenchmarkQueryTextFormatDecode_PG_int4_to_Go_pgtype_Int4_100_rows_10_columns(b *testing.B) {
   696  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   697  		b.ResetTimer()
   698  		var v [10]pgtype.Int4
   699  		for i := 0; i < b.N; i++ {
   700  			rows, _ := conn.Query(
   701  				ctx,
   702  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 100) n`,
   703  				pgx.QueryResultFormats{pgx.TextFormatCode},
   704  			)
   705  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   706  			if err != nil {
   707  				b.Fatal(err)
   708  			}
   709  		}
   710  	})
   711  }
   712  
   713  func BenchmarkQueryBinaryFormatDecode_PG_int4_to_Go_pgtype_Int4_100_rows_10_columns(b *testing.B) {
   714  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   715  		b.ResetTimer()
   716  		var v [10]pgtype.Int4
   717  		for i := 0; i < b.N; i++ {
   718  			rows, _ := conn.Query(
   719  				ctx,
   720  				`select n::int4 + 0, n::int4 + 1, n::int4 + 2, n::int4 + 3, n::int4 + 4, n::int4 + 5, n::int4 + 6, n::int4 + 7, n::int4 + 8, n::int4 + 9 from generate_series(1, 100) n`,
   721  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   722  			)
   723  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   724  			if err != nil {
   725  				b.Fatal(err)
   726  			}
   727  		}
   728  	})
   729  }
   730  
   731  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_int64_1_rows_1_columns(b *testing.B) {
   732  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   733  		b.ResetTimer()
   734  		var v [1]int64
   735  		for i := 0; i < b.N; i++ {
   736  			rows, _ := conn.Query(
   737  				ctx,
   738  				`select n::numeric + 0 from generate_series(1, 1) n`,
   739  				pgx.QueryResultFormats{pgx.TextFormatCode},
   740  			)
   741  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   742  			if err != nil {
   743  				b.Fatal(err)
   744  			}
   745  		}
   746  	})
   747  }
   748  
   749  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_int64_1_rows_1_columns(b *testing.B) {
   750  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   751  		b.ResetTimer()
   752  		var v [1]int64
   753  		for i := 0; i < b.N; i++ {
   754  			rows, _ := conn.Query(
   755  				ctx,
   756  				`select n::numeric + 0 from generate_series(1, 1) n`,
   757  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   758  			)
   759  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   760  			if err != nil {
   761  				b.Fatal(err)
   762  			}
   763  		}
   764  	})
   765  }
   766  
   767  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_int64_1_rows_10_columns(b *testing.B) {
   768  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   769  		b.ResetTimer()
   770  		var v [10]int64
   771  		for i := 0; i < b.N; i++ {
   772  			rows, _ := conn.Query(
   773  				ctx,
   774  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 1) n`,
   775  				pgx.QueryResultFormats{pgx.TextFormatCode},
   776  			)
   777  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   778  			if err != nil {
   779  				b.Fatal(err)
   780  			}
   781  		}
   782  	})
   783  }
   784  
   785  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_int64_1_rows_10_columns(b *testing.B) {
   786  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   787  		b.ResetTimer()
   788  		var v [10]int64
   789  		for i := 0; i < b.N; i++ {
   790  			rows, _ := conn.Query(
   791  				ctx,
   792  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 1) n`,
   793  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   794  			)
   795  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   796  			if err != nil {
   797  				b.Fatal(err)
   798  			}
   799  		}
   800  	})
   801  }
   802  
   803  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_int64_10_rows_1_columns(b *testing.B) {
   804  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   805  		b.ResetTimer()
   806  		var v [1]int64
   807  		for i := 0; i < b.N; i++ {
   808  			rows, _ := conn.Query(
   809  				ctx,
   810  				`select n::numeric + 0 from generate_series(1, 10) n`,
   811  				pgx.QueryResultFormats{pgx.TextFormatCode},
   812  			)
   813  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   814  			if err != nil {
   815  				b.Fatal(err)
   816  			}
   817  		}
   818  	})
   819  }
   820  
   821  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_int64_10_rows_1_columns(b *testing.B) {
   822  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   823  		b.ResetTimer()
   824  		var v [1]int64
   825  		for i := 0; i < b.N; i++ {
   826  			rows, _ := conn.Query(
   827  				ctx,
   828  				`select n::numeric + 0 from generate_series(1, 10) n`,
   829  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   830  			)
   831  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   832  			if err != nil {
   833  				b.Fatal(err)
   834  			}
   835  		}
   836  	})
   837  }
   838  
   839  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_int64_100_rows_10_columns(b *testing.B) {
   840  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   841  		b.ResetTimer()
   842  		var v [10]int64
   843  		for i := 0; i < b.N; i++ {
   844  			rows, _ := conn.Query(
   845  				ctx,
   846  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 100) n`,
   847  				pgx.QueryResultFormats{pgx.TextFormatCode},
   848  			)
   849  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   850  			if err != nil {
   851  				b.Fatal(err)
   852  			}
   853  		}
   854  	})
   855  }
   856  
   857  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_int64_100_rows_10_columns(b *testing.B) {
   858  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   859  		b.ResetTimer()
   860  		var v [10]int64
   861  		for i := 0; i < b.N; i++ {
   862  			rows, _ := conn.Query(
   863  				ctx,
   864  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 100) n`,
   865  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   866  			)
   867  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   868  			if err != nil {
   869  				b.Fatal(err)
   870  			}
   871  		}
   872  	})
   873  }
   874  
   875  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_float64_1_rows_1_columns(b *testing.B) {
   876  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   877  		b.ResetTimer()
   878  		var v [1]float64
   879  		for i := 0; i < b.N; i++ {
   880  			rows, _ := conn.Query(
   881  				ctx,
   882  				`select n::numeric + 0 from generate_series(1, 1) n`,
   883  				pgx.QueryResultFormats{pgx.TextFormatCode},
   884  			)
   885  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   886  			if err != nil {
   887  				b.Fatal(err)
   888  			}
   889  		}
   890  	})
   891  }
   892  
   893  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_float64_1_rows_1_columns(b *testing.B) {
   894  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   895  		b.ResetTimer()
   896  		var v [1]float64
   897  		for i := 0; i < b.N; i++ {
   898  			rows, _ := conn.Query(
   899  				ctx,
   900  				`select n::numeric + 0 from generate_series(1, 1) n`,
   901  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   902  			)
   903  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   904  			if err != nil {
   905  				b.Fatal(err)
   906  			}
   907  		}
   908  	})
   909  }
   910  
   911  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_float64_1_rows_10_columns(b *testing.B) {
   912  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   913  		b.ResetTimer()
   914  		var v [10]float64
   915  		for i := 0; i < b.N; i++ {
   916  			rows, _ := conn.Query(
   917  				ctx,
   918  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 1) n`,
   919  				pgx.QueryResultFormats{pgx.TextFormatCode},
   920  			)
   921  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   922  			if err != nil {
   923  				b.Fatal(err)
   924  			}
   925  		}
   926  	})
   927  }
   928  
   929  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_float64_1_rows_10_columns(b *testing.B) {
   930  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   931  		b.ResetTimer()
   932  		var v [10]float64
   933  		for i := 0; i < b.N; i++ {
   934  			rows, _ := conn.Query(
   935  				ctx,
   936  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 1) n`,
   937  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   938  			)
   939  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   940  			if err != nil {
   941  				b.Fatal(err)
   942  			}
   943  		}
   944  	})
   945  }
   946  
   947  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_float64_10_rows_1_columns(b *testing.B) {
   948  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   949  		b.ResetTimer()
   950  		var v [1]float64
   951  		for i := 0; i < b.N; i++ {
   952  			rows, _ := conn.Query(
   953  				ctx,
   954  				`select n::numeric + 0 from generate_series(1, 10) n`,
   955  				pgx.QueryResultFormats{pgx.TextFormatCode},
   956  			)
   957  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   958  			if err != nil {
   959  				b.Fatal(err)
   960  			}
   961  		}
   962  	})
   963  }
   964  
   965  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_float64_10_rows_1_columns(b *testing.B) {
   966  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   967  		b.ResetTimer()
   968  		var v [1]float64
   969  		for i := 0; i < b.N; i++ {
   970  			rows, _ := conn.Query(
   971  				ctx,
   972  				`select n::numeric + 0 from generate_series(1, 10) n`,
   973  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
   974  			)
   975  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
   976  			if err != nil {
   977  				b.Fatal(err)
   978  			}
   979  		}
   980  	})
   981  }
   982  
   983  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_float64_100_rows_10_columns(b *testing.B) {
   984  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
   985  		b.ResetTimer()
   986  		var v [10]float64
   987  		for i := 0; i < b.N; i++ {
   988  			rows, _ := conn.Query(
   989  				ctx,
   990  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 100) n`,
   991  				pgx.QueryResultFormats{pgx.TextFormatCode},
   992  			)
   993  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
   994  			if err != nil {
   995  				b.Fatal(err)
   996  			}
   997  		}
   998  	})
   999  }
  1000  
  1001  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_float64_100_rows_10_columns(b *testing.B) {
  1002  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1003  		b.ResetTimer()
  1004  		var v [10]float64
  1005  		for i := 0; i < b.N; i++ {
  1006  			rows, _ := conn.Query(
  1007  				ctx,
  1008  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 100) n`,
  1009  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
  1010  			)
  1011  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
  1012  			if err != nil {
  1013  				b.Fatal(err)
  1014  			}
  1015  		}
  1016  	})
  1017  }
  1018  
  1019  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_pgtype_Numeric_1_rows_1_columns(b *testing.B) {
  1020  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1021  		b.ResetTimer()
  1022  		var v [1]pgtype.Numeric
  1023  		for i := 0; i < b.N; i++ {
  1024  			rows, _ := conn.Query(
  1025  				ctx,
  1026  				`select n::numeric + 0 from generate_series(1, 1) n`,
  1027  				pgx.QueryResultFormats{pgx.TextFormatCode},
  1028  			)
  1029  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
  1030  			if err != nil {
  1031  				b.Fatal(err)
  1032  			}
  1033  		}
  1034  	})
  1035  }
  1036  
  1037  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_pgtype_Numeric_1_rows_1_columns(b *testing.B) {
  1038  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1039  		b.ResetTimer()
  1040  		var v [1]pgtype.Numeric
  1041  		for i := 0; i < b.N; i++ {
  1042  			rows, _ := conn.Query(
  1043  				ctx,
  1044  				`select n::numeric + 0 from generate_series(1, 1) n`,
  1045  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
  1046  			)
  1047  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
  1048  			if err != nil {
  1049  				b.Fatal(err)
  1050  			}
  1051  		}
  1052  	})
  1053  }
  1054  
  1055  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_pgtype_Numeric_1_rows_10_columns(b *testing.B) {
  1056  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1057  		b.ResetTimer()
  1058  		var v [10]pgtype.Numeric
  1059  		for i := 0; i < b.N; i++ {
  1060  			rows, _ := conn.Query(
  1061  				ctx,
  1062  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 1) n`,
  1063  				pgx.QueryResultFormats{pgx.TextFormatCode},
  1064  			)
  1065  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
  1066  			if err != nil {
  1067  				b.Fatal(err)
  1068  			}
  1069  		}
  1070  	})
  1071  }
  1072  
  1073  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_pgtype_Numeric_1_rows_10_columns(b *testing.B) {
  1074  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1075  		b.ResetTimer()
  1076  		var v [10]pgtype.Numeric
  1077  		for i := 0; i < b.N; i++ {
  1078  			rows, _ := conn.Query(
  1079  				ctx,
  1080  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 1) n`,
  1081  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
  1082  			)
  1083  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
  1084  			if err != nil {
  1085  				b.Fatal(err)
  1086  			}
  1087  		}
  1088  	})
  1089  }
  1090  
  1091  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_pgtype_Numeric_10_rows_1_columns(b *testing.B) {
  1092  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1093  		b.ResetTimer()
  1094  		var v [1]pgtype.Numeric
  1095  		for i := 0; i < b.N; i++ {
  1096  			rows, _ := conn.Query(
  1097  				ctx,
  1098  				`select n::numeric + 0 from generate_series(1, 10) n`,
  1099  				pgx.QueryResultFormats{pgx.TextFormatCode},
  1100  			)
  1101  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
  1102  			if err != nil {
  1103  				b.Fatal(err)
  1104  			}
  1105  		}
  1106  	})
  1107  }
  1108  
  1109  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_pgtype_Numeric_10_rows_1_columns(b *testing.B) {
  1110  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1111  		b.ResetTimer()
  1112  		var v [1]pgtype.Numeric
  1113  		for i := 0; i < b.N; i++ {
  1114  			rows, _ := conn.Query(
  1115  				ctx,
  1116  				`select n::numeric + 0 from generate_series(1, 10) n`,
  1117  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
  1118  			)
  1119  			_, err := pgx.ForEachRow(rows, []any{&v[0]}, func() error { return nil })
  1120  			if err != nil {
  1121  				b.Fatal(err)
  1122  			}
  1123  		}
  1124  	})
  1125  }
  1126  
  1127  func BenchmarkQueryTextFormatDecode_PG_numeric_to_Go_pgtype_Numeric_100_rows_10_columns(b *testing.B) {
  1128  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1129  		b.ResetTimer()
  1130  		var v [10]pgtype.Numeric
  1131  		for i := 0; i < b.N; i++ {
  1132  			rows, _ := conn.Query(
  1133  				ctx,
  1134  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 100) n`,
  1135  				pgx.QueryResultFormats{pgx.TextFormatCode},
  1136  			)
  1137  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
  1138  			if err != nil {
  1139  				b.Fatal(err)
  1140  			}
  1141  		}
  1142  	})
  1143  }
  1144  
  1145  func BenchmarkQueryBinaryFormatDecode_PG_numeric_to_Go_pgtype_Numeric_100_rows_10_columns(b *testing.B) {
  1146  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1147  		b.ResetTimer()
  1148  		var v [10]pgtype.Numeric
  1149  		for i := 0; i < b.N; i++ {
  1150  			rows, _ := conn.Query(
  1151  				ctx,
  1152  				`select n::numeric + 0, n::numeric + 1, n::numeric + 2, n::numeric + 3, n::numeric + 4, n::numeric + 5, n::numeric + 6, n::numeric + 7, n::numeric + 8, n::numeric + 9 from generate_series(1, 100) n`,
  1153  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
  1154  			)
  1155  			_, err := pgx.ForEachRow(rows, []any{&v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9]}, func() error { return nil })
  1156  			if err != nil {
  1157  				b.Fatal(err)
  1158  			}
  1159  		}
  1160  	})
  1161  }
  1162  
  1163  func BenchmarkQueryTextFormatDecode_PG_Int4Array_With_Go_Int4Array_10(b *testing.B) {
  1164  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1165  		b.ResetTimer()
  1166  		var v []int32
  1167  		for i := 0; i < b.N; i++ {
  1168  			rows, _ := conn.Query(
  1169  				ctx,
  1170  				`select array_agg(n) from generate_series(1, 10) n`,
  1171  				pgx.QueryResultFormats{pgx.TextFormatCode},
  1172  			)
  1173  			_, err := pgx.ForEachRow(rows, []any{&v}, func() error { return nil })
  1174  			if err != nil {
  1175  				b.Fatal(err)
  1176  			}
  1177  		}
  1178  	})
  1179  }
  1180  
  1181  func BenchmarkQueryBinaryFormatDecode_PG_Int4Array_With_Go_Int4Array_10(b *testing.B) {
  1182  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1183  		b.ResetTimer()
  1184  		var v []int32
  1185  		for i := 0; i < b.N; i++ {
  1186  			rows, _ := conn.Query(
  1187  				ctx,
  1188  				`select array_agg(n) from generate_series(1, 10) n`,
  1189  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
  1190  			)
  1191  			_, err := pgx.ForEachRow(rows, []any{&v}, func() error { return nil })
  1192  			if err != nil {
  1193  				b.Fatal(err)
  1194  			}
  1195  		}
  1196  	})
  1197  }
  1198  
  1199  func BenchmarkQueryTextFormatDecode_PG_Int4Array_With_Go_Int4Array_100(b *testing.B) {
  1200  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1201  		b.ResetTimer()
  1202  		var v []int32
  1203  		for i := 0; i < b.N; i++ {
  1204  			rows, _ := conn.Query(
  1205  				ctx,
  1206  				`select array_agg(n) from generate_series(1, 100) n`,
  1207  				pgx.QueryResultFormats{pgx.TextFormatCode},
  1208  			)
  1209  			_, err := pgx.ForEachRow(rows, []any{&v}, func() error { return nil })
  1210  			if err != nil {
  1211  				b.Fatal(err)
  1212  			}
  1213  		}
  1214  	})
  1215  }
  1216  
  1217  func BenchmarkQueryBinaryFormatDecode_PG_Int4Array_With_Go_Int4Array_100(b *testing.B) {
  1218  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1219  		b.ResetTimer()
  1220  		var v []int32
  1221  		for i := 0; i < b.N; i++ {
  1222  			rows, _ := conn.Query(
  1223  				ctx,
  1224  				`select array_agg(n) from generate_series(1, 100) n`,
  1225  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
  1226  			)
  1227  			_, err := pgx.ForEachRow(rows, []any{&v}, func() error { return nil })
  1228  			if err != nil {
  1229  				b.Fatal(err)
  1230  			}
  1231  		}
  1232  	})
  1233  }
  1234  
  1235  func BenchmarkQueryTextFormatDecode_PG_Int4Array_With_Go_Int4Array_1000(b *testing.B) {
  1236  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1237  		b.ResetTimer()
  1238  		var v []int32
  1239  		for i := 0; i < b.N; i++ {
  1240  			rows, _ := conn.Query(
  1241  				ctx,
  1242  				`select array_agg(n) from generate_series(1, 1000) n`,
  1243  				pgx.QueryResultFormats{pgx.TextFormatCode},
  1244  			)
  1245  			_, err := pgx.ForEachRow(rows, []any{&v}, func() error { return nil })
  1246  			if err != nil {
  1247  				b.Fatal(err)
  1248  			}
  1249  		}
  1250  	})
  1251  }
  1252  
  1253  func BenchmarkQueryBinaryFormatDecode_PG_Int4Array_With_Go_Int4Array_1000(b *testing.B) {
  1254  	defaultConnTestRunner.RunTest(context.Background(), b, func(ctx context.Context, _ testing.TB, conn *pgx.Conn) {
  1255  		b.ResetTimer()
  1256  		var v []int32
  1257  		for i := 0; i < b.N; i++ {
  1258  			rows, _ := conn.Query(
  1259  				ctx,
  1260  				`select array_agg(n) from generate_series(1, 1000) n`,
  1261  				pgx.QueryResultFormats{pgx.BinaryFormatCode},
  1262  			)
  1263  			_, err := pgx.ForEachRow(rows, []any{&v}, func() error { return nil })
  1264  			if err != nil {
  1265  				b.Fatal(err)
  1266  			}
  1267  		}
  1268  	})
  1269  }