MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestTranspile_QuerySourceShow

Function TestTranspile_QuerySourceShow

transpiler/query_source_test.go:47–62  ·  view source on GitHub ↗

TestTranspile_QuerySourceShow asserts `SHOW duckgres.query_source` is intercepted (answered session-side) rather than treated as an unrecognized config parameter or forwarded to DuckDB.

(t *testing.T)

Source from the content-addressed store, hash-verified

45 if result.QuerySourceShow {
46 t.Errorf("Transpile(%q): QuerySourceShow = true, want false", tt.input)
47 }
48 })
49 }
50}
51
52// TestTranspile_QuerySourceSetInvalidRejected asserts that a SET with a value
53// outside the closed {standard, endpoints} set surfaces Result.Error with
54// SQLSTATE 22023 (invalid_parameter_value) and does NOT populate
55// QuerySourceSet. The value is the billing-bucket key, so accepting arbitrary
56// strings would hand clients unbounded cardinality (and junk) in the billing
57// table and its exports. The error message must name the valid values but must
58// NOT echo the offending value (arbitrary client input flowing into logs / the
59// recent-errors ring).
60func TestTranspile_QuerySourceSetInvalidRejected(t *testing.T) {
61 tr := New(DefaultConfig())
62
63 longJunk := strings.Repeat("x", 10*1024)
64 inputs := map[string]string{
65 "garbage": "SET duckgres.query_source = 'garbage'",

Callers

nothing calls this directly

Calls 3

TranspileMethod · 0.80
NewFunction · 0.70
DefaultConfigFunction · 0.70

Tested by

no test coverage detected