[postmodern-devel] IF-EXISTS operator for DROP-* ops
I'm wanting to use the IF EXISTS modifier for the various DROP operations, and it seems like the semantics of CASCADE works best for this case. The following is a proof of concept implementation. If there aren't any issues or complaints I'll write a patch that covers the rest of the DROP operations. (defvar *expand-if-exists* nil) (defun expand-if-exists () (when *expand-if-exists* `("IF EXISTS "))) (def-sql-op :if-exists (op) (let ((*expand-if-exists* t)) (sql-expand op))) (def-sql-op :drop-sequence (name) `("DROP SEQUENCE " ,@(expand-if-exists) ,@(sql-expand name))) (sql (:if-exists (:drop-sequence 'sequence))) Cheers, -- Daniel White
Good suggestion, but I think the special variable thing is a bit more cognitive overload than it's worth. I just added an extra argument to all the :drop-... operators, and am now generating them through a macro. Pull from repository to see the change. Best, Marijn
participants (2)
-
Daniel White
-
Marijn Haverbeke