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

Function TestTypesNullHandling

tests/integration/types_test.go:251–280  ·  view source on GitHub ↗

TestTypesNullHandling tests NULL handling across types

(t *testing.T)

Source from the content-addressed store, hash-verified

249 }
250 runQueryTests(t, tests)
251}
252
253// TestTypesNullHandling tests NULL handling across types
254func TestTypesNullHandling(t *testing.T) {
255 tests := []QueryTest{
256 // NULL comparisons
257 {Name: "null_equals", Query: "SELECT NULL = NULL"},
258 {Name: "null_is_null", Query: "SELECT NULL IS NULL"},
259 {Name: "null_is_not_null", Query: "SELECT NULL IS NOT NULL"},
260 {Name: "null_is_distinct_from_null", Query: "SELECT NULL IS DISTINCT FROM NULL"},
261 {Name: "null_is_not_distinct_from_null", Query: "SELECT NULL IS NOT DISTINCT FROM NULL"},
262
263 // NULL in expressions
264 {Name: "null_arithmetic", Query: "SELECT 1 + NULL"},
265 {Name: "null_concat", Query: "SELECT 'hello' || NULL"},
266 {Name: "null_and_true", Query: "SELECT NULL AND TRUE"},
267 {Name: "null_or_true", Query: "SELECT NULL OR TRUE"},
268
269 // COALESCE
270 {Name: "coalesce_null", Query: "SELECT COALESCE(NULL, 'default')"},
271 {Name: "coalesce_value", Query: "SELECT COALESCE('value', 'default')"},
272 {Name: "coalesce_multiple", Query: "SELECT COALESCE(NULL, NULL, 'third')"},
273
274 // NULLIF
275 {Name: "nullif_equal", Query: "SELECT NULLIF(1, 1)"},
276 {Name: "nullif_different", Query: "SELECT NULLIF(1, 2)"},
277
278 // From table with NULLs
279 {Name: "select_nullable", Query: "SELECT * FROM nullable_test WHERE val1 IS NULL"},
280 {Name: "count_nulls", Query: "SELECT COUNT(*), COUNT(val1), COUNT(val2) FROM nullable_test"},
281 }
282 runQueryTests(t, tests)
283}

Callers

nothing calls this directly

Calls 1

runQueryTestsFunction · 0.85

Tested by

no test coverage detected