 (emacsql-defexpander :set (set)
   (emacsql-with-vars "SET "
     (cl-etypecase set
-      (vector (combine (emacsql--idents set)))
-      (list (combine (emacsql--expr set))))))
+      (vector (idents set))
+      (list (expr set)))))
 
 (emacsql-defexpander :union ()
   (list "UNION"))

    string))

(defmacro emacsql-with-vars (prefix &rest body)
  "Evaluate BODY, collecting variables with `var' and `combine'.
BODY should return a string, which will be combined with variable
definitions for return from a `emacsql-defexpander'."
  (declare (indent 1))
  `(let ((emacsql--vars ()))
     (cl-letf (((emacsql-symbol-function 'var)
                (symbol-function 'emacsql--vars-var))
               ((emacsql-symbol-function 'combine)
                (symbol-function 'emacsql--vars-combine)))
       (cons (concat ,prefix (progn ,@body)) emacsql--vars))))

(declare-function combine nil (expanded))
(declare-function var nil (thing kind))

(defun emacsql--vector (vector)
  "Expand VECTOR, making variables as needed."

      (symbol (var table :identifier))
      (list (cl-destructuring-bind (name columns) table
              (format "%s (%s)" (var name :identifier)
                      (idents columns)))))))

(emacsql-defexpander :where (expr)
  (emacsql-with-vars "WHERE "
    (expr expr)))

(emacsql-defexpander :group-by (expr)
  (emacsql-with-vars "GROUP BY "
    (expr expr)))

(emacsql-defexpander :ascending-by (columns)
  (emacsql-with-vars "ORDER BY "
