diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..a32b4d68 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "go.inferGopath": false, + "go.testEnvVars": { + "PGX_TEST_DATABASE": "user=postgres database=pgx_test host=127.0.0.1" + }, +} \ No newline at end of file diff --git a/composite_test.go b/composite_test.go index 666de054..ac0eb4d0 100644 --- a/composite_test.go +++ b/composite_test.go @@ -25,6 +25,8 @@ create type mytype as ( E(err) defer conn.Exec(context.Background(), "drop type mytype") + qrf := pgx.QueryResultFormats{pgx.BinaryFormatCode} + var isNull bool var a int var b *string @@ -32,18 +34,18 @@ create type mytype as ( c := pgtype.NewComposite(&pgtype.Int4{}, &pgtype.Text{}) c.SetFields(2, "bar") - err = conn.QueryRow(context.Background(), "select $1::mytype", c). + err = conn.QueryRow(context.Background(), "select $1::mytype", qrf, c). Scan(c.Scan(&isNull, &a, &b)) E(err) fmt.Printf("First: isNull=%v a=%d b=%s\n", isNull, a, *b) - err = conn.QueryRow(context.Background(), "select (1, NULL)::mytype").Scan(c.Scan(&isNull, &a, &b)) + err = conn.QueryRow(context.Background(), "select (1, NULL)::mytype", qrf).Scan(c.Scan(&isNull, &a, &b)) E(err) fmt.Printf("Second: isNull=%v a=%d b=%v\n", isNull, a, b) - err = conn.QueryRow(context.Background(), "select NULL::mytype").Scan(c.Scan(&isNull, &a, &b)) + err = conn.QueryRow(context.Background(), "select NULL::mytype", qrf).Scan(c.Scan(&isNull, &a, &b)) E(err) fmt.Printf("Third: isNull=%v\n", isNull)