Skip to content
Prev Previous commit
Next Next commit
Add integration test for DuckDB engine
Adds a test to verify that:
- DuckDB engine can be instantiated via NewCompiler
- PostgreSQL catalog is properly initialized
- Default schema is set to 'public' as expected

Test confirms DuckDB engine integration is working correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
  • Loading branch information
claude committed Oct 29, 2025
commit 8d805ca93182d3bf206675ab1e842427f9ed6684
36 changes: 36 additions & 0 deletions internal/engine/duckdb/duckdb_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package duckdb_test

import (
"testing"

"github.com/sqlc-dev/sqlc/internal/compiler"
"github.com/sqlc-dev/sqlc/internal/config"
)

func TestDuckDBEngineCreation(t *testing.T) {
conf := config.SQL{
Engine: config.EngineDuckDB,
}

combo := config.CombinedSettings{}

c, err := compiler.NewCompiler(conf, combo)
if err != nil {
t.Fatalf("Failed to create DuckDB compiler: %v", err)
}

if c == nil {
t.Fatal("Compiler is nil")
}

// Verify catalog was initialized
catalog := c.Catalog()
if catalog == nil {
t.Fatal("Catalog is nil")
}

// Verify it uses PostgreSQL catalog (has pg_catalog schema)
if catalog.DefaultSchema != "public" {
t.Errorf("Expected default schema 'public', got %q", catalog.DefaultSchema)
}
}