From a6f8595c4bae6dbd1faf9388d71078766cb6d830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Mon, 13 Jul 2026 00:27:48 +0200 Subject: [PATCH] poi-index: stream selectors SQL into psql stdin (fix \i container path) poi-import.sh ran the classifier selectors via psql \i, but psql executes inside the postgres container (docker compose exec), so it couldn't find the host path /opt/trails-cool/scripts/poi-selectors.sql. Concatenate BEGIN + the selectors file contents + the build statements on the host and pipe them into psql stdin instead, keeping the ON COMMIT DROP temp table in one transaction. Co-Authored-By: Claude Opus 4.8 (1M context) --- infrastructure/scripts/poi-import.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/infrastructure/scripts/poi-import.sh b/infrastructure/scripts/poi-import.sh index 1ff9afe..bfcce87 100755 --- a/infrastructure/scripts/poi-import.sh +++ b/infrastructure/scripts/poi-import.sh @@ -105,10 +105,16 @@ gunzip -c "$ARTIFACT" | psql -c \ # One transaction: temp selector table (from map-core) → pois_staging built # LIKE the live table so structure/defaults match the Drizzle schema exactly → # classified insert → indexes. The 70% guard + swap run in step 5. +# +# The selector SQL is streamed from the host into psql's stdin (not `\i`, which +# would look for the file inside the postgres container, where it doesn't +# exist). BEGIN + selectors + the build statements are concatenated into one +# session so the ON COMMIT DROP temp table lives for the whole transaction. log "building classified staging table" -psql <