make sure :create-enum does not double-escape reserved words
Mon Mar 22 02:04:13 PDT 2010 marijnh@gmail.com
* make sure :create-enum does not double-escape reserved words
Warning: CRC errors found. These are probably harmless but should be repaired.
See 'darcs gzcrcs --help' for more information.
diff -rN -u old-postmodern/s-sql/s-sql.lisp new-postmodern/s-sql/s-sql.lisp
--- old-postmodern/s-sql/s-sql.lisp 2014-07-24 23:45:01.000000000 -0700
+++ new-postmodern/s-sql/s-sql.lisp 2014-07-24 23:45:01.000000000 -0700
@@ -262,9 +262,6 @@
(otherwise char)))))
(princ #\'))))
-(defmethod cl-postgres:to-sql-string ((value symbol))
- (to-sql-name value))
-
(defgeneric sql-ize (arg)
(:documentation "Get the representation of a Lisp value so that it
can be used in a query.")
@@ -788,7 +785,8 @@
`("CREATE VIEW " ,(to-sql-name name) " AS " ,@(sql-expand query)))
(def-sql-op :create-enum (name members)
- `("CREATE TYPE " ,@(sql-expand name) " AS ENUM (" ,@(sql-expand-list (mapcar #'sql-ize members)) ") "))
+ (let ((strings (loop :for m :in members :collect (etypecase m (symbol (string-downcase m)) (string m)))))
+ `("CREATE TYPE " ,@(sql-expand name) " AS ENUM (" ,@(sql-expand-list strings) ")")))
;;; http://www.postgresql.org/docs/8.3/interactive/sql-createdomain.html
(def-sql-op :create-domain (name &rest args)