Skip to content

fix(db): widen location and path columns — prevent varchar(255) overflow - #96

Merged
Metrohan merged 2 commits into
mainfrom
fix/varchar-overflow
Aug 3, 2026
Merged

fix(db): widen location and path columns — prevent varchar(255) overflow#96
Metrohan merged 2 commits into
mainfrom
fix/varchar-overflow

Conversation

@Metrohan

@Metrohan Metrohan commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Problem

DB alarm firing every scraper run (00:00 and 12:00 UTC):

ERROR: value too long for type character varying(255)

Root cause

events.location and pending_events.location are VARCHAR(255). Some scraped sources return full-address strings (e.g. `Conference Hall, 123 Very Long Street Name, Kadıköy, Istanbul, 34000`) that exceed the limit and cause the insert to fail — the event is silently dropped.

traffic_logs.path is also VARCHAR(255) and can overflow when bots hit long URLs.

Fix

Column Before After
events.location VARCHAR(255) TEXT
pending_events.location VARCHAR(255) TEXT
traffic_logs.path VARCHAR(255) VARCHAR(500)

PostgreSQL widens VARCHAR → TEXT as a metadata-only operation (no table rewrite, no row locks beyond the catalog update).

Deploy note

Run after merge:

docker-compose run --rm backend alembic upgrade head

Test plan

  • pytest tests/ --ignore=tests/unit/test_image_pipeline.py -m "not integration" passes
  • alembic upgrade head runs without error
  • No more varchar overflow errors in DB logs after next scraper run

🤖 Generated with Claude Code

Metrohan and others added 2 commits August 4, 2026 00:10
…flow

events.location and pending_events.location -> Text (unbounded): scrapers
pull full-address strings from some sources that exceed 255 chars.
traffic_logs.path -> String(500): bots occasionally send very long URLs.

PostgreSQL widens VARCHAR to TEXT with a metadata-only operation — no
table rewrite, no row locks. Requires alembic upgrade head after deploy.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
f7a8b9c0d1e2 was chaining from e6f7a8b9c0d1 but f1a2b3c4d5e6
(add_event_thumbnail_url) had already advanced the head from that
revision, creating two heads. Point down_revision at f1a2b3c4d5e6.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Metrohan
Metrohan merged commit 8ea2449 into main Aug 3, 2026
4 checks passed
@Metrohan
Metrohan deleted the fix/varchar-overflow branch August 3, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant