r9528: move special variable declaration
[clsql.git] / sql / expressions.lisp
index 80d735c1ee07eed15b4a6d13f20d35116382477f..cc2e53b20fcab7f189b85ebd14fdd9a937607a99 100644 (file)
                        :test (lambda (tab1 tab2)
                                (equal (slot-value tab1 'name)
                                       (slot-value tab2 'name))))))
+(defvar *in-subselect* nil)
 
 (defmethod output-sql ((expr sql-function-exp) database)
   (with-slots (name args)
     expr
     (output-sql name database)
-    (when args (output-sql args database)))
+    (let ((*in-subselect* nil)) ;; aboid double parens
+      (when args (output-sql args database))))
   t)
 
 
@@ -563,8 +565,6 @@ uninclusive, and the args from that keyword to the end."
                           :group-by group-by :having having :order-by order-by
                           :inner-join inner-join :on on))))))
 
-(defvar *in-subselect* nil)
-
 (defmethod output-sql ((query sql-query) database)
   (with-slots (distinct selections from where group-by having order-by
                         limit offset inner-join on all set-operation)