The alternative fix is to change the implemention of `sql-magic-go' so it doesn't interfere with caps-lock-mode; this would absolve the user from the responsability of customizing which commands trigger case change, but requires more invasive changes to sql.el (at least I haven't come up with a simpler change), specifically, (i) removing the bindings of "o" and "O", (ii) making `sql-magic-go' a function instead of a command, which checks if the last keyboard input was either of these letters and if so, does what `sql-magic-go' is supposed to do, and (iii) adding `sql-magic-go' to `post-self-insert-hook' if `sql-electric-stuff' is customized to give the string "go" special handling. Here's the patch: