Skip to content

Commit

Permalink
Fix automatic quoting of table or partition name starting with a numb…
Browse files Browse the repository at this point in the history
…er. Thanks to Barzaqh for the report.
  • Loading branch information
darold committed Sep 26, 2018
1 parent 570e9ed commit da5e628
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/Ora2Pg.pm
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ sub quote_object_name
if (!$self->{preserve_case}) {
$obj_name = lc($obj_name);
# then if there is non alphanumeric or the object name is a reserved word
if ($obj_name =~ /[^a-z0-9\_\.]/ || ($self->{use_reserved_words} && $self->is_reserved_words($obj_name))) {
if ($obj_name =~ /[^a-z0-9\_\.]/ || ($self->{use_reserved_words} && $self->is_reserved_words($obj_name)) || $obj_name =~ /^\d+/) {
# Add double quote to [schema.] object name
if ($obj_name !~ /^[^\.]+\.[^\.]+$/) {
$obj_name = '"' . $obj_name . '"';
Expand Down Expand Up @@ -6065,7 +6065,6 @@ BEGIN
my $old_part = '';
my $owner = '';
foreach my $pos (sort {$a <=> $b} keys %{$self->{partitions}{$table}}) {
print STDERR "PARTITION: $table :: $pos :: $self->{partitions}{$table}{$pos}{name}\n";
next if (!$self->{partitions}{$table}{$pos}{name});
my $part = $self->{partitions}{$table}{$pos}{name};
if (!$self->{quiet} && !$self->{debug}) {
Expand Down Expand Up @@ -8502,9 +8501,9 @@ VARCHAR2

if ($part_name) {
if ($is_subpart) {
$alias = "SUBPARTITION($part_name) a";
$alias = "SUBPARTITION(" . $self->quote_object_name($part_name) . ") a";
} else {
$alias = "PARTITION($part_name) a";
$alias = "PARTITION(". $self->quote_object_name($part_name) . ") a";
}
}
# Force parallelism on Oracle side
Expand Down

0 comments on commit da5e628

Please sign in to comment.