fix: upsert DO NOTHING when updateCols empty, title model uses tabular model for Ollama

↗ view on GitHub · Glauco · 2026-05-10 · 27fa98f6

Two bugs:

1. PgAdapter upsert with only the conflict column (e.g. upsert({ user_id })
   on conflict user_id) produced "DO UPDATE SET " with an empty SET
   clause - invalid SQL. Now falls through to DO NOTHING when updateCols
   is empty, and supports the Supabase ignoreDuplicates:true option.
   This fixed "syntax error at end of input" on ensureProfileRow calls.

2. resolveTitleModel checked "apiKeys.ollama !== undefined" to detect
   Ollama, but the apiKeys object always initialises ollama: null (not
   undefined), so the condition was always true - every user with no cloud
   keys got title_model = local-gemma-26b which doesn't exist on Ollama.
   Fixed to check hasEnvOllama() || key.trim(), and when Ollama is the
   provider, reuse the user's configured tabular model (which they know is
   installed) instead of a hardcoded default.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Repository rglauco/mike
Author Glauco <37829079+rglauco@users.noreply.github.com>
Authored
Parents b92cbf52
Stats 2 files changed , +20 , -8
Part of Docker Compose + Local Postgres (Supabase-Optional Mode)

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-27fa98f6.md from inside the repo you want the change in.

⬇ Download capture-commit-27fa98f6.md