fixed :from clauses to not throw errors when presented with a string or string expression
authorRuss Tyndall <russ@acceleration.net>
Thu, 24 Feb 2011 18:39:02 +0000 (13:39 -0500)
committerNathan Bird <nathan@acceleration.net>
Thu, 30 Jun 2011 20:56:28 +0000 (16:56 -0400)
sql/expressions.lisp

index efb54bb650f00338d4b17590b9e6d346060aa3ef..b80806439c0ac71f13ab77e0a379e4e46cd0afbd 100644 (file)
@@ -602,14 +602,16 @@ uninclusive, and the args from that keyword to the end."
       (output-sql (apply #'vector selections) database))
     (when from
       (write-string " FROM " *sql-stream*)
-      (flet ((ident-table-equal (a b)
-               (and (if (and (eql (type-of a) 'sql-ident-table)
-                             (eql (type-of b) 'sql-ident-table))
-                        (string-equal (slot-value a 'alias)
-                                      (slot-value b 'alias))
-                        t)
-                    (string-equal (sql-escape (slot-value a 'name))
-                                  (sql-escape (slot-value b 'name))))))
+      (labels ((ident-string-val (a)
+                 (typecase a
+                   (sql-ident
+                    (or (ignore-errors (slot-value a 'alias))
+                        (ignore-errors (slot-value a 'name))))
+                   (string a)))
+               (ident-table-equal (a b)
+                 ;; The things should be type compatable
+                 (string-equal (ident-string-val a)
+                               (ident-string-val b))))
         (typecase from
           (list (output-sql (apply #'vector
                                    (remove-duplicates from