Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions lib/Ora2Pg.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7468,8 +7468,10 @@ sub export_tablespace
if ($self->{file_per_index} && (scalar keys %{$self->{tablespaces}} > 0))
{
my $fhdl = undef;
$self->logit("Dumping tablespace alter indexes to one separate file : TBSP_INDEXES_$self->{output}\n", 1);
$fhdl = $self->open_export_file("TBSP_INDEXES_$self->{output}");
my ($filename, $dirname) = fileparse($self->{output});
my $tbsp_indexes_file = File::Spec->catfile($dirname, "TBSP_INDEXES_$filename");
$self->logit("Dumping tablespace alter indexes to one separate file : $tbsp_indexes_file\n", 1);
$fhdl = $self->open_export_file($tbsp_indexes_file);
$self->set_binmode($fhdl) if (!$self->{compress});
$sql_output = '';
foreach my $tb_type (sort keys %{$self->{tablespaces}})
Expand Down Expand Up @@ -8319,12 +8321,14 @@ FOR EACH ROW EXECUTE PROCEDURE $trg();
if ($partition_indexes)
{
my $fhdl = undef;
$self->logit("Dumping partition indexes to file : PARTITION_INDEXES_$self->{output}\n", 1);
my ($filename, $dirname) = fileparse($self->{output});
my $partition_indexes_file = File::Spec->catfile($dirname, "PARTITION_INDEXES_$filename");
$self->logit("Dumping partition indexes to file : $partition_indexes_file\n", 1);
$sql_header = "-- Generated by Ora2Pg, the Oracle database Schema converter, version $VERSION\n";
$sql_header .= "-- Copyright 2000-2025 Gilles DAROLD. All rights reserved.\n";
$sql_header .= "-- DATASOURCE: $self->{oracle_dsn}\n\n";
$sql_header = '' if ($self->{no_header});
$fhdl = $self->open_export_file("PARTITION_INDEXES_$self->{output}");
$fhdl = $self->open_export_file($partition_indexes_file);
$self->set_binmode($fhdl) if (!$self->{compress});
$self->dump($sql_header . $partition_indexes, $fhdl);
$self->close_export_file($fhdl);
Expand Down Expand Up @@ -9271,8 +9275,10 @@ LANGUAGE PLPGSQL;
};
$sequence_output = $fct_sequence . $sequence_output;
$sequence_output .= "DROP FUNCTION ora2pg_upd_autoincrement_seq(text, text);\n";
$self->logit("Dumping DDL to restart autoincrement sequences into separate file : AUTOINCREMENT_$self->{output}\n", 1);
$fhdl = $self->open_export_file("AUTOINCREMENT_$self->{output}");
my ($filename, $dirname) = fileparse($self->{output});
my $autoincrement_file = File::Spec->catfile($dirname, "AUTOINCREMENT_$filename");
$self->logit("Dumping DDL to restart autoincrement sequences into separate file : $autoincrement_file\n", 1);
$fhdl = $self->open_export_file($autoincrement_file);
$self->set_binmode($fhdl) if (!$self->{compress});
$sequence_output = $self->set_search_path() . $sequence_output;
$self->dump($sql_header . $sequence_output, $fhdl);
Expand All @@ -9282,8 +9288,10 @@ LANGUAGE PLPGSQL;
if ($self->{type} ne 'FDW')
{
my $fhdl = undef;
$self->logit("Dumping replicat identity information to one separate file : LOGICAL_$self->{output}\n", 1);
$fhdl = $self->open_export_file("LOGICAL_$self->{output}");
my ($filename, $dirname) = fileparse($self->{output});
my $logical_file = File::Spec->catfile($dirname, "LOGICAL_$filename");
$self->logit("Dumping replicat identity information to one separate file : $logical_file\n", 1);
$fhdl = $self->open_export_file($logical_file);
$self->set_binmode($fhdl) if (!$self->{compress});
$replicat_identity = "-- Nothing found of type indexes\n" if (!$replicat_identity && !$self->{no_header});
$replicat_identity = $self->set_search_path() . $replicat_identity;
Expand All @@ -9293,8 +9301,10 @@ LANGUAGE PLPGSQL;
if ($self->{file_per_index} && ($self->{type} ne 'FDW'))
{
my $fhdl = undef;
$self->logit("Dumping indexes to one separate file : INDEXES_$self->{output}\n", 1);
$fhdl = $self->open_export_file("INDEXES_$self->{output}");
my ($filename, $dirname) = fileparse($self->{output});
my $indexes_file = File::Spec->catfile($dirname, "INDEXES_$filename");
$self->logit("Dumping indexes to one separate file : $indexes_file\n", 1);
$fhdl = $self->open_export_file($indexes_file);
$self->set_binmode($fhdl) if (!$self->{compress});
$indices = "-- Nothing found of type indexes\n" if (!$indices && !$self->{no_header});
$indices =~ s/\n+/\n/gs;
Expand Down Expand Up @@ -9328,8 +9338,10 @@ RETURNS text AS
};
}
# FTS TRIGGERS are exported in a separated file to be able to parallelize index creation
$self->logit("Dumping triggers for FTS indexes to one separate file : FTS_INDEXES_$self->{output}\n", 1);
$fhdl = $self->open_export_file("FTS_INDEXES_$self->{output}");
my ($filename, $dirname) = fileparse($self->{output});
my $fts_indexes_file = File::Spec->catfile($dirname, "FTS_INDEXES_$filename");
$self->logit("Dumping triggers for FTS indexes to one separate file : $fts_indexes_file\n", 1);
$fhdl = $self->open_export_file($fts_indexes_file);
$self->set_binmode($fhdl) if (!$self->{compress});
$self->_restore_comments(\$fts_indices);
$fts_indices = $self->set_search_path() . $fts_indices;
Expand Down