 
 See also `emacsql-with-errors'."
   (prog1 keyword
+    (clrhash emacsql-expander-cache)
     (push (list keyword arity function) emacsql-expanders)))
 
 (defmacro emacsql-defexpander (keyword args &rest body)

(defvar emacsql-expanders ()
  "Alist of all expansion functions.")

(defun emacsql-add-expander (keyword arity function)
  "Register FUNCTION for KEYWORD as a SQL expander.
FUNCTION should accept the keyword's arguments and should return


(defun emacsql-expand (sql)
  "Expand SQL into a SQL-consumable string, with variables."
  (let* ((cache emacsql-expander-cache)
         (cached (and cache (gethash sql cache))))
    (or cached
        (cl-loop with items = (cl-coerce sql 'list)
                 while (not (null items))
                 for keyword = (pop items)
                 for (arity expander) = (cdr (assoc keyword emacsql-expanders))
                 when expander
                 collect (apply expander (cl-subseq items 0 arity)) into parts
                 else do (error "Unrecognized keyword %s" keyword)
                 do (setf items (cl-subseq items arity))
                 finally
                 (let ((string (concat (mapconcat #'car parts " ") ";"))
                       (vars (apply #'nconc (mapcar #'cdr parts))))
                   (cl-return (setf (gethash sql cache)
                                    (cons string vars))))))))

(defun emacsql-format (expansion &rest args)
  "Fill in the variables EXPANSION with ARGS."
