Subject: | Database schemaname with special chars |
if the schema has a name like "my-schema" the exporter cannot export the
tables from the schema, because sub _tables_list cannot handle it (from
D::C::S::L::DBI).
in _tables_list are some regex that parse @tables (from the db) which
can be:
my_schema.my_table
"my-schema".my_table
my_schema."my-table"
"my-schema"."my-table"
The regex does NOT the correct job! I was not to able to create a
failing test for that :-/ But simple checking that regex can show that
(attached script will print):
my_schema.my_table VS my_table
"my-schema".my_table VS my-schema.my_table
my_schema."my-table" VS my-table
"my-schema"."my-table" VS my-table
Our schemaname has a minus :-/
Perhaps checking a schemaname with a _namesep in it should be a good idear.
Subject: | test.pl |
my $self = {
_quoter => '"',
_namesep => '.',
};
foreach my $table (qw/
my_schema.my_table
"my-schema".my_table
my_schema."my-table"
"my-schema"."my-table"
/) {
my @tables = ($table);
my $qt = qr/[\Q$self->{_quoter}\E"'`\[\]]/;
my $all_tables_quoted = (grep /$qt/, @tables) == @tables;
if ($self->{_quoter} && $all_tables_quoted) {
s/.* $qt (?= .* $qt )//xg for @tables;
} else {
s/^.*\Q$self->{_namesep}\E// for @tables;
}
s/$qt//g for @tables;
print "$table VS $tables[0]\n";
}