From dfe5c38185bb9f0ed9a26746d24319ed95f84ccc Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Thu, 6 Jul 2017 09:45:53 +0200 Subject: [PATCH] Fix quoting policy in PostgreSQL ddl formating. We already have apply-identifier-case and *identifier-case* to decide how and when to quote our SQL object names, so don't force extra quotes in format string: refrain from using ~s. --- src/pgsql/pgsql-ddl.lisp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/pgsql/pgsql-ddl.lisp b/src/pgsql/pgsql-ddl.lisp index cf233e4..3b3e59e 100644 --- a/src/pgsql/pgsql-ddl.lisp +++ b/src/pgsql/pgsql-ddl.lisp @@ -198,22 +198,15 @@ (let* ((schema-name (schema-name (index-schema index))) (index-name (index-name index))) (cond ((index-conname index) - ;; here always quote the constraint name, currently the name - ;; comes from one source only, the PostgreSQL database catalogs, - ;; so don't question it, quote it. - ;; - ;; The constraint name could begin with numbers of follow other - ;; force-quoting PostgreSQL rules, so we really quote it (using - ;; ~s here). (format stream - "ALTER TABLE ~a DROP CONSTRAINT~:[~; IF EXISTS~] ~s~@[ CASCADE~];" + "ALTER TABLE ~a DROP CONSTRAINT~:[~; IF EXISTS~] ~a~@[ CASCADE~];" (format-table-name (index-table index)) if-exists (index-conname index) cascade)) (t - (format stream "DROP INDEX~:[~; IF EXISTS~] ~@[~s.~]~s~@[ CASCADE~];" + (format stream "DROP INDEX~:[~; IF EXISTS~] ~@[~a.~]~a~@[ CASCADE~];" if-exists schema-name index-name cascade))))) (defun index-access-method (index)