From 8f6915d626bf668251b5624587e95493116c81e4 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sat, 8 Feb 2014 17:31:59 +0100 Subject: [PATCH] Fix issur #29, using proper quoting. The patch from pull request #30 was hard-coding the PostgreSQL side quoting, we are using the quote_ident() function instead, as it's now available in every PostgreSQL production release (8.4 included). --- src/pgsql/queries.lisp | 2 +- src/sources/mysql-cast-rules.lisp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pgsql/queries.lisp b/src/pgsql/queries.lisp index 6f65dc2..29c38c3 100644 --- a/src/pgsql/queries.lisp +++ b/src/pgsql/queries.lisp @@ -196,7 +196,7 @@ BEGIN from replace(pg_get_expr(d.adbin, d.adrelid), 'nextval', 'setval')) || ', (select greatest(max(' || a.attname || '), 1) from only ' - || nspname || '.' || relname || '));' as sql + || quote_ident(nspname) || '.' || quote_ident(relname) || '));' as sql FROM pg_class c JOIN pg_namespace n on n.oid = c.relnamespace JOIN pg_attribute a on a.attrelid = c.oid diff --git a/src/sources/mysql-cast-rules.lisp b/src/sources/mysql-cast-rules.lisp index ac8fbf8..b2cb82a 100644 --- a/src/sources/mysql-cast-rules.lisp +++ b/src/sources/mysql-cast-rules.lisp @@ -32,14 +32,14 @@ The type naming is hardcoded to be table-name_column-name" (declare (ignore type ctype typemod)) - (format nil "~a_~a" table-name column-name)) + (format nil "\"~a_~a\"" table-name column-name)) (defun cast-set (table-name column-name type ctype typemod) "Cast MySQL inline SET type to using a PostgreSQL ENUM Array. The ENUM data type name is hardcoded to be table-name_column-name" (declare (ignore type ctype typemod)) - (format nil "~a_~a[]" table-name column-name)) + (format nil "\"~a_~a\"[]" table-name column-name)) ;;; ;;; The default MySQL Type Casting Rules