Fix conjunctions for the INCLUDING clause in MySQL.

We want all table matching any of the given constraints (regexp or
equality search).
This commit is contained in:
Dimitri Fontaine 2014-09-23 16:44:38 +02:00
parent 128cb4c80a
commit 8a0c91fa40
2 changed files with 5 additions and 4 deletions

View File

@ -184,7 +184,7 @@ order by table_name" dbname only-tables))))
join information_schema.tables t using(table_schema, table_name)
where c.table_schema = '~a' and t.table_type = '~a'
~:[~*~;and table_name in (~{'~a'~^,~})~]
~:[~*~;and (~{table_name ~a~^ and ~})~]
~:[~*~;and (~{table_name ~a~^ or ~})~]
~:[~*~;and (~{table_name ~a~^ and ~})~]
order by table_name, ordinal_position"
dbname
@ -226,7 +226,7 @@ order by table_name, ordinal_position"
FROM information_schema.statistics
WHERE table_schema = '~a'
~:[~*~;and table_name in (~{'~a'~^,~})~]
~:[~*~;and (~{table_name ~a~^ and ~})~]
~:[~*~;and (~{table_name ~a~^ or ~})~]
~:[~*~;and (~{table_name ~a~^ and ~})~]
GROUP BY table_name, index_name;"
dbname
@ -299,7 +299,7 @@ GROUP BY table_name, index_name;"
AND k.referenced_table_schema = '~a'
AND i.constraint_type = 'FOREIGN KEY'
~:[~*~;and table_name in (~{'~a'~^,~})~]
~:[~*~;and (~{table_name ~a~^ and ~})~]
~:[~*~;and (~{table_name ~a~^ or ~})~]
~:[~*~;and (~{table_name ~a~^ and ~})~]
GROUP BY table_name, constraint_name, ft;"

View File

@ -2,7 +2,8 @@ LOAD DATABASE
FROM mysql://root@unix:/tmp/mysql.sock:/goeuro
INTO postgresql://dim@unix:/tmp:/godollar
-- INCLUDING ONLY TABLE NAMES MATCHING ~/encoding/
INCLUDING ONLY TABLE NAMES MATCHING ~/encoding/, ~/b/
EXCLUDING TABLE NAMES MATCHING ~/encoding/
DECODING TABLE NAMES MATCHING ~/messed/, ~/encoding/ AS utf-8