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)) (all-indexes (list-all-indexes dbname))
(max-indexes (loop for (table . indexes) in all-indexes (max-indexes (loop for (table . indexes) in all-indexes
maximizing (length indexes))) maximizing (length indexes)))
(idx-kernel (when max-indexes (idx-kernel (when (and max-indexes (< 0 max-indexes))
(make-kernel max-indexes))) (make-kernel max-indexes)))
(idx-channel (let ((lp:*kernel* idx-kernel)) (idx-channel (when idx-kernel
(lp:make-channel)))) (let ((lp:*kernel* idx-kernel))
(lp:make-channel)))))
;; if asked, first drop/create the tables on the PostgreSQL side ;; if asked, first drop/create the tables on the PostgreSQL side
(when create-tables (when create-tables

View File

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

View File

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