Enum Value Discovery Before SQL Where

Use BEFORE writing any SQL WHERE-clause that filters on a string/enum-typed column. Schema-verify via `\d <table>` shows COLUMN TYPE (text/varchar/enum) but NOT the actual values used. Code may set 'taken' while the reviewer thinks 'accept'. Pattern: run `SELECT DISTINCT <col> FROM <table>` (or grep for `_update_<col>`-style setters) to discover the actual value-set BEFORE formulating WHERE. Without this discovery step, queries silently return wrong counts: rows matching the real value get excluded, user sees "0 results" while reality has many. Trigger on phrases like "how many entities with status X exist", "user_response='accept'", "SELECT ... WHERE enum_col=...", "why am I seeing no hits", "forensic DB analysis", "cockpit filter shows 0". Do NOT load for known well-defined PostgreSQL ENUM types where `\d` shows values inline, first-time-CREATE-TABLE queries, or non-text/non-enum columns.

Ed3Design 18ab595 9.1 KB Updated

File contents

Ed3Design/ed3design-skill-bundles/tree/main/schema-discipline/skills/enum-value-discovery-before-sql-where commit 18ab5954ae

Frequently asked questions

npx skillmds@latest add ed3design/enum-value-discovery-before-sql-where