TestBindingWithOidZero tests the behavior of binding parameters when the client specifies a zero OID for any of the parameters.
(t *testing.T)
| 26 | // TestBindingWithOidZero tests the behavior of binding parameters when the client specifies a zero OID for any of |
| 27 | // the parameters. |
| 28 | func 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 | |
| 56 | func TestIssue2386(t *testing.T) { |
| 57 | // https://github.com/dolthub/doltgresql/issues/2386 |
nothing calls this directly
no test coverage detected