#98: check-queries — PREPARE every query plus the PROPERTYNAME cross-check #148
No reviewers
Labels
No labels
blocked
claude-wip
map-report
map:is
map:se
needs-review
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
art/ismap!148
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-98-check-queries"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #98
#98: check-queries — PREPARE every query plus the PROPERTYNAME cross-check
What changed
importer check-queries <config>— the guard #98 proposed, landed on thesubcommand shape #129 reserved for it. It catches a layer query reading a
column the source fetch does not request, the failure that shipped once in
#79 and was invisible to review: the broken predicate and the unchanged URL
were a thousand lines apart, and every local signal said fine (the staging
table predated the narrowing, so the query was verified honestly against a
database the config could not reproduce).
Two halves, both read-only (PREPARE + DEALLOCATE, nothing written):
runs against the destination database, is PREPAREd against the live DB and
discarded. Postgres resolves column references without executing, so a
query reading a column its source does not provide fails with 42703 here,
near-free, catching typos in every query at once. Two skip classes, both
the partial-database convention: a query whose table/type is not in this
database yet, and a layer query that reads a source GeoPackage or a foreign
postgres (those run only at import time, against that database). A missing
column is always a failure.
a WFS
PROPERTYNAME=list (the server honours it strictly), the stagingtables loaded from that file are found, and the columns every query whose
staging:deps include them references are checked against the list. Nodatabase needed, so it is the half that would have failed on the author's
box for #79 — the one whose staging table still carried the dropped
column. References are attributed through FROM/JOIN aliases by a small SQL
scanner (strings/comments/dollar-quotes stripped); unqualified column names
can't be attributed to a table without a full parser and are left to the
PREPARE half.
Also:
make check-queriesruns the guard on all five configs; the mode table,a dedicated section, and the subcommand list in
docs/importer-cli.md;AGENTS.md's CLI index.
This is a mechanism-level check, not an SQL acceptance test — it must read the
config's queries and download URLs, which an
acceptance_tests:query cannotreach. Precedent:
tiles --check(the other Go walker against the livedatabase). Not a mechanism gap to file; the same argument that admits
tiles --checkadmits this.Verification
make build,make test(importer + mapsrv),go vet,gofmt -lclean.importer/checkqueries_test.go, no DB): the PROPERTYNAMEparser; the SQL scanner against the real
placesquery (the #79 shape) andagainst string/comment/number noise; the cross-check on a synthetic config
reproducing the #79 regression (flagged) and the fixed PROPERTYNAME list
(clean); the load→download wirings (file, databases entry, glob); the
local/remote source split; the CLI dispatch.
TestRealConfigsPropertyNameCrossCheckruns the static half against all five real configs — clean after the #79 fix.
importer check-querieson all five configs: (The skips are layer queries reading source GeoPackages — Sweden's roadsread
SverigepaketTPfromse_vagdata_tp— and Iceland's roads/water etc.reading
samgongur_linur-style source tables: they run at import timeagainst the file, not the destination.)
scenario):
placesreads
g.rodzajobiektu→ 1 propertyname violation, exit 1, while thePREPARE half still passes (stale table has the column) — exactly the #79
shape;
g.bogus_column→ PREPARE fails, 42703, exit 1;make acceptance(all five configs, fast bucket): still 0 failed — theshared dispatch change regresses nothing.
Left undone / notes
an unqualified column reference (
SELECT nazwaglowna FROM pl_prng_m1)is left to the PREPARE half. Fine for the bug class, worth knowing.
staging:depsdeclare the table. An undeclared reference to a constrained table is a
DAG bug of its own and is caught by the PREPARE half (against whatever is
staged) rather than the static half.
column names when narrowing a fetch) is process advice, not code — the
guard now automates it.
Closes #98to #98: check-queries — PREPARE every query plus the PROPERTYNAME cross-check