r9615: * sql/expressions.lisp: Avoid duplicate FROM names when selecting
[clsql.git] / sql / expressions.lisp
index 10b1130aa11dd81f38a0dc5199bfa3788c9a5f74..f2d63c9c85c47e9dd810bce8dff46480291692d8 100644 (file)
@@ -579,7 +579,12 @@ uninclusive, and the args from that keyword to the end."
     (when from
       (write-string " FROM " *sql-stream*)
       (typecase from 
-        (list (output-sql (apply #'vector from) database))
+        (list (output-sql (apply #'vector (remove-duplicates 
+                                          from 
+                                          :test #'(lambda (a b)
+                                                    (string-equal (symbol-name (slot-value a 'name))
+                                                                  (symbol-name (slot-value b 'name))))))
+                         database))
         (string (write-string from *sql-stream*))
         (t (output-sql from database))))
     (when inner-join