Fix: Escape literal % in LIKE pattern in B1 metadata diagnostic

psycopg2 performs %-substitution when params are passed to execute(),
so 'M%' in the LIKE clause was being interpreted as a positional
placeholder, raising IndexError when there's only one real %s (LIMIT).
Escape as 'M%%' so it's preserved as a literal percent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
nickviljoen 2026-04-29 11:47:21 +02:00
parent 23bcc057c5
commit 3c69e7545a

View file

@ -55,7 +55,7 @@ def main():
cursor.execute("""
SELECT tracking_id, original_filename, full_metadata
FROM master_assets
WHERE tracking_id LIKE 'M%'
WHERE tracking_id LIKE 'M%%'
AND local_campaign_id IS NULL
AND status = 'active'
ORDER BY created_at DESC