schema-to-sql: drop stale insert_* overloads before creating the function #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "schema-to-sql-drop-stale-overloads"
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?
Problem
CREATE OR REPLACE FUNCTIONonly replaces a function whose argument types are unchanged. When an ArcGIS schema's field list changes, the regeneratedinsert_<table>function keeps the prior argument-type identity and the new definition lands as an additional overload. Callers resolve a single signature by parameter name, so the old identities become unreachable dead code. In nidus-sync this stranded 29 overloads across the fieldseekerinsert_*procs (speciesabundance and traplocation had two each).Change
Emit a guard before the
CREATEthat drops every existing overload of the same insert function in the schema:The guard and the
CREATEare separate-- +goose StatementBegin/Endblocks so the DO block's internal semicolons are not split.Verification
CREATE.go test ./cmd/schema-to-sql/,go vet ./cmd/schema-to-sql/, andgofmt -lare clean.Note:
go test ./...still fails to buildfieldseeker/andexamples/at this commit; that is pre-existing and unrelated to this change.