Skip to content

Commit be4774c

Browse files
kyleconroyclaude
andcommitted
test: add end-to-end tests for accurate analyzer mode
Add three end-to-end test cases for the accurate analyzer mode: 1. accurate_star_expansion - Tests SELECT *, INSERT RETURNING *, UPDATE RETURNING *, DELETE RETURNING * 2. accurate_enum - Tests enum type introspection from pg_catalog 3. accurate_cte - Tests CTE (Common Table Expression) with star expansion All tests use the managed-db context which requires Docker to run PostgreSQL containers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent aa392c7 commit be4774c

File tree

21 files changed

+492
-0
lines changed

21 files changed

+492
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"contexts": ["managed-db"]
3+
}

internal/endtoend/testdata/accurate_cte/postgresql/stdlib/go/db.go

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/endtoend/testdata/accurate_cte/postgresql/stdlib/go/models.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/endtoend/testdata/accurate_cte/postgresql/stdlib/go/query.sql.go

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- name: ListExpensiveProducts :many
2+
WITH expensive AS (
3+
SELECT * FROM products WHERE price > 100
4+
)
5+
SELECT * FROM expensive;
6+
7+
-- name: GetProductStats :one
8+
WITH product_stats AS (
9+
SELECT COUNT(*) as total, AVG(price) as avg_price FROM products
10+
)
11+
SELECT * FROM product_stats;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CREATE TABLE products (
2+
id SERIAL PRIMARY KEY,
3+
name TEXT NOT NULL,
4+
price NUMERIC(10,2) NOT NULL
5+
);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "2"
2+
sql:
3+
- engine: postgresql
4+
schema: "schema.sql"
5+
queries: "query.sql"
6+
analyzer:
7+
accurate: true
8+
gen:
9+
go:
10+
package: "querytest"
11+
out: "go"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"contexts": ["managed-db"]
3+
}

internal/endtoend/testdata/accurate_enum/postgresql/stdlib/go/db.go

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/endtoend/testdata/accurate_enum/postgresql/stdlib/go/models.go

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)