(msgs []wireMsg)
| 216 | |
| 217 | // TestQuerySourceMixedBatchWithNormalStatement asserts a batch mixing the |
| 218 | // custom GUC with a normal statement (`SET duckgres.query_source='endpoints'; |
| 219 | // SELECT 1`) still executes the SELECT — the GUC statement must not swallow the |
| 220 | // rest of the batch. |
| 221 | func TestQuerySourceMixedBatchWithNormalStatement(t *testing.T) { |
| 222 | exec := &selectOneExecutor{} |
| 223 | c, out := newBufferedConn(exec) |
| 224 | |
| 225 | if err := c.handleQuery([]byte("SET duckgres.query_source = 'endpoints'; SELECT 1\x00")); err != nil { |
| 226 | t.Fatalf("handleQuery: %v", err) |
| 227 | } |
| 228 | |
| 229 | if exec.queryCalls != 1 { |
| 230 | t.Fatalf("SELECT did not run: QueryContext called %d times, want 1", exec.queryCalls) |
| 231 | } |
| 232 | if got := c.QuerySource(); got != "endpoints" { |
| 233 | t.Fatalf("session QuerySource() = %q, want %q", got, "endpoints") |
| 234 | } |
| 235 | |
| 236 | msgs := parseWireMsgs(t, out.Bytes()) |
no test coverage detected