Assorted MySQL migration bugfixes (reset sequence formating, etc).

This commit is contained in:
Dimitri Fontaine 2013-10-05 22:38:09 +02:00
parent 09a49f4771
commit fe68fba3d3
3 changed files with 11 additions and 10 deletions

View File

@ -520,10 +520,11 @@ order by ordinal_position" dbname table-name)))
(all-indexes (list-all-indexes dbname))
(max-indexes (loop for (table . indexes) in all-indexes
maximizing (length indexes)))
(idx-kernel (when max-indexes
(idx-kernel (when (and max-indexes (< 0 max-indexes))
(make-kernel max-indexes)))
(idx-channel (let ((lp:*kernel* idx-kernel))
(lp:make-channel))))
(idx-channel (when idx-kernel
(let ((lp:*kernel* idx-kernel))
(lp:make-channel)))))
;; if asked, first drop/create the tables on the PostgreSQL side
(when create-tables

View File

@ -626,8 +626,6 @@ Here's a quick description of the format we're parsing here:
pg-db-uri
`(lambda ()
(let* ((pgloader.mysql:*cast-rules* ',casts)
(pgloader.mysql::*pgsql-reserved-keywords*
(pgloader.pgsql:list-reserved-keywords ,pgdb))
(*myconn-host* ,myhost)
(*myconn-port* ,myport)
(*myconn-user* ,myuser)
@ -636,7 +634,9 @@ Here's a quick description of the format we're parsing here:
(*pgconn-port* ,pgport)
(*pgconn-user* ,pguser)
(*pgconn-pass* ,pgpass)
(*pg-settings* ',gucs))
(*pg-settings* ',gucs)
(pgloader.mysql::*pgsql-reserved-keywords*
(pgloader.pgsql:list-reserved-keywords ,pgdb)))
(declare (special pgloader.mysql:*cast-rules*
*myconn-host* *myconn-port*
*myconn-user* *myconn-pass*

View File

@ -130,7 +130,7 @@ select relname, array_agg(case when typname in ('date', 'timestamptz')
(pomo:execute "listen seqs")
(handler-case
(pomo:execute "
(pomo:execute (format nil "
DO $$
DECLARE
n integer := 0;
@ -150,8 +150,8 @@ BEGIN
and d.adnum = a.attnum
and a.atthasdef
WHERE relkind = 'r' and a.attnum > 0
and pg_get_expr(d.adbin, d.adrelid) ~ '^nextval'
~@[and ~{~a~^, ~}~]
and pg_get_expr(d.adbin, d.adrelid) ~~ '^nextval'
~@[and c.oid in ~{'~a'::regclass~^, ~}~]
LOOP
n := n + 1;
EXECUTE r.sql;
@ -159,7 +159,7 @@ BEGIN
PERFORM pg_notify('seqs', n::text);
END;
$$; " only-tables)
$$; " only-tables))
;; now get the notification signal
(cl-postgres:postgresql-notification (c)
(parse-integer (cl-postgres:postgresql-notification-payload c))))))