--- id: dd597163-635b-4408-a209-54a33c0732e5 type: solution title: "PostgreSQL EXCLUDED column name fix for Peewee upserts" tags: [paper-dynasty, postgresql, peewee, upsert, fix] importance: 0.8 confidence: 0.8 created: "2026-01-30T23:28:53.941663+00:00" updated: "2026-01-30T23:28:53.941663+00:00" --- When using Peewee's on_conflict() with EXCLUDED for PostgreSQL, must use the actual column_name not the field name. ForeignKeyFields have column names ending in _id (e.g., field 'batter' -> column 'batter_id'). Fix: EXCLUDED[field_obj.column_name] instead of EXCLUDED[field_name]