       (log/error (str "SQL error: " (.printStackTrace (.getNextException(.getSQLException e))))))))
 
 (defn insert-lexeme [canonical lexeme language]
+  (log/debug (str "insert-lexeme: canonical=" canonical ",lexeme=" lexeme ",language=" language))
   (if (fail? lexeme)
     (let [message (str "Refusing to enter a :fail for canonical form: " canonical)] 
       (log/error message)

    (exec-raw [(str "INSERT INTO lexeme 
                                 (canonical, structure, serialized, language) 
                          VALUES (?,"
                    "'" (json/write-str (strip-refs lexeme)) "'"
                    ",?,?)")
               [canonical (str (serialize lexeme))
                language]])))


  (try
    (exec-raw [(str "INSERT INTO " table " (surface, structure, serialized, language, model) VALUES (?,"
                    "$$" (json/write-str (strip-refs expression)) "$$"
                    ","
                    "$$" (str (serialize expression)) "$$"
                    ","
                    "?,?)")
               [surface
