GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — duckdb: a named statement that the converter cannot handle is dropped without an error · Issue #4656 · sqlc-dev/sqlc Open DescriptionVersion
What happened?A statement with a I saw this for The behavior is not consistent. A A caller expects a method that does not exist, and the build breaks later. A reviewer sees a clean Expected: Cause
Reproductionrepro2.sh#!/usr/bin/env bash rm -rf repro2 && mkdir repro2 && cd repro2 cat > sqlc.yaml <<'EOF' version: "2" sql: - engine: "duckdb" schema: "schema.sql" queries: "query.sql" gen: go: package: "repro" out: "out" EOF cat > schema.sql <<'EOF' CREATE TABLE items (id INTEGER NOT NULL, name VARCHAR NOT NULL); EOF methods() { if [ -f out/query.sql.go ]; then grep -c '^func (q \*Queries)' out/query.sql.go; else echo 0; fi; } cat > query.sql <<'EOF' -- name: ListItems :many SELECT id, name FROM items; -- name: ExportItems :exec COPY (SELECT id, name FROM items) TO 'items.parquet' (FORMAT PARQUET); EOF sqlc generate; echo "sqlc exit code: $?"; echo "generated methods: $(methods)" echo while IFS= read -r stmt; do printf -- '-- name: ListItems :many\nSELECT id, name FROM items;\n\n-- name: Other :exec\n%s\n' "$stmt" > query.sql rm -rf out; sqlc generate >/dev/null 2>&1; rc=$? printf '%-34s exit=%s methods=%s\n' "$stmt" "$rc" "$(methods)" done <<'EOF' EXPORT DATABASE 'export_dir'; ATTACH 'other.db' AS other; SET threads = 2; PRAGMA enable_progress_bar; INSTALL spatial; CALL pragma_version(); EOF echo printf -- "-- name: ExportItems :exec\nCOPY (SELECT id, name FROM items) TO 'items.parquet' (FORMAT PARQUET);\n" > query.sql rm -rf out; sqlc generate; echo "sqlc exit code: $?" echo echo "== statements WITHOUT an annotation in the schema file are skipped, before and after" printf 'INSTALL spatial;\nLOAD spatial;\nSET threads = 2;\nCREATE TABLE items (id INTEGER NOT NULL, name VARCHAR NOT NULL);\n' > schema.sql printf -- '-- name: ListItems :many\nSELECT id, name FROM items;\n' > query.sql rm -rf out; sqlc generate; echo "sqlc exit code: $?"; echo "generated methods: $(methods)" FixI have a patch with end-to-end test cases, and I will open a pull request. Relevant log outputsqlc exit code: 0 generated methods: 1 EXPORT DATABASE 'export_dir'; exit=0 methods=1 ATTACH 'other.db' AS other; exit=0 methods=1 SET threads = 2; exit=0 methods=1 PRAGMA enable_progress_bar; exit=0 methods=1 INSTALL spatial; exit=0 methods=1 CALL pragma_version(); exit=0 methods=1 # package repro error parsing queries: no queries contained in paths ./repro2/query.sql sqlc exit code: 1 == statements WITHOUT an annotation in the schema file are skipped, before and after sqlc exit code: 0 generated methods: 1 Database schemaCREATE TABLE items (id INTEGER NOT NULL, name VARCHAR NOT NULL); SQL queries-- name: ListItems :many SELECT id, name FROM items; -- name: ExportItems :exec COPY (SELECT id, name FROM items) TO 'items.parquet' (FORMAT PARQUET); Configurationversion: "2" sql: - engine: "duckdb" schema: "schema.sql" queries: "query.sql" gen: go: package: "repro" out: "out" Playground URLNot available. play.sqlc.dev runs only v1.18.0–v1.25.0, and the DuckDB engine is not in a release (v1.25.0 answers What operating system are you using?Linux What database engines are you using?(none of the listed options; the engine is duckdb) What type of code are you generating?Go ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |