From 8ec2ea04db19e242de497736e3ac6b174b094140 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sat, 25 Feb 2017 21:52:41 +0100 Subject: [PATCH] Add support for MySQL geometry points. The new version of the sakila database uses geometry typed columns that contain POINT data. Add support for that kind of data by copying what we did already for POINT datatype. --- src/sources/mysql/mysql-cast-rules.lisp | 4 ++++ src/sources/mysql/mysql-schema.lisp | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sources/mysql/mysql-cast-rules.lisp b/src/sources/mysql/mysql-cast-rules.lisp index e81c48f..00c9bd2 100644 --- a/src/sources/mysql/mysql-cast-rules.lisp +++ b/src/sources/mysql/mysql-cast-rules.lisp @@ -135,6 +135,10 @@ :using pgloader.transforms::set-to-enum-array) ;; geometric data types, just POINT for now + (:source (:type "geometry") + :target (:type "point") + :using pgloader.transforms::convert-mysql-point) + (:source (:type "point") :target (:type "point") :using pgloader.transforms::convert-mysql-point)) diff --git a/src/sources/mysql/mysql-schema.lisp b/src/sources/mysql/mysql-schema.lisp index 223cc40..ca40283 100644 --- a/src/sources/mysql/mysql-schema.lisp +++ b/src/sources/mysql/mysql-schema.lisp @@ -398,8 +398,9 @@ order by table_name, ordinal_position" Mostly we just use the name, but in case of POINT we need to use astext(name)." (case (intern (string-upcase type) "KEYWORD") - (:point (format nil "astext(`~a`) as `~a`" name name)) - (t (format nil "`~a`" name)))) + (:geometry (format nil "astext(`~a`) as `~a`" name name)) + (:point (format nil "astext(`~a`) as `~a`" name name)) + (t (format nil "`~a`" name)))) (defun get-column-list (dbname table-name) "Some MySQL datatypes have a meaningless default output representation, we