MCPcopy Create free account
hub / github.com/dolthub/doltgresql / TestBindingWithOidZero

Function TestBindingWithOidZero

testing/go/binding_test.go:28–54  ·  view source on GitHub ↗

TestBindingWithOidZero tests the behavior of binding parameters when the client specifies a zero OID for any of the parameters.

(t *testing.T)

Source from the content-addressed store, hash-verified

26// TestBindingWithOidZero tests the behavior of binding parameters when the client specifies a zero OID for any of
27// the parameters.
28func TestBindingWithOidZero(t *testing.T) {
29 // Start up a test server
30 ctx, connection, controller := CreateServer(t, "postgres")
31 defer func() {
32 connection.Close(ctx)
33 controller.Stop()
34 require.NoError(t, controller.WaitForStop())
35 }()
36 conn := connection.Default
37
38 // Create a table to insert into
39 _, err := connection.Exec(ctx, "CREATE TABLE my_table (id INT, name varchar(100));")
40 require.NoError(t, err)
41
42 args := [][]byte{
43 []byte(strconv.Itoa(42)),
44 []byte("Alice"),
45 }
46 paramOIDs := []uint32{0, 123}
47 paramFormats := []int16{0, 0}
48 sql := "INSERT INTO my_table (id, name) VALUES ($1, $2);"
49
50 // Execute a query with the zero OID and assert that we don't get an error
51 resultReader := conn.PgConn().ExecParams(ctx, sql, args, paramOIDs, paramFormats, nil)
52 result := resultReader.Read()
53 require.NoError(t, result.Err)
54}
55
56func TestIssue2386(t *testing.T) {
57 // https://github.com/dolthub/doltgresql/issues/2386

Callers

nothing calls this directly

Calls 5

ExecMethod · 0.80
CreateServerFunction · 0.70
CloseMethod · 0.65
StopMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected