Skip to content

Commit

Permalink
add support for materialized views in Oracle producer
Browse files Browse the repository at this point in the history
  • Loading branch information
abraxxa committed Nov 30, 2018
1 parent 86c68a0 commit 601e4ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Changes for SQL::Translator

* Add support for parsing PostgreSQL dollar-quoted strings
* Add support for materialized views in Oracle producer

0.11024 2018-01-09

Expand Down
13 changes: 11 additions & 2 deletions lib/SQL/Translator/Producer/Oracle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -732,13 +732,22 @@ sub create_view {
my ($view, $options) = @_;
my $qt = $options->{quote_table_names};
my $view_name = quote($view->name,$qt);
my %extra = $view->extra;

my $view_type = 'VIEW';
my $view_options = '';
if ( exists $extra{materialized} && $extra{materialized} ) {
$view_type = 'MATERIALIZED VIEW';
$view_options = $extra{materialized};
}

my @create;
push @create, qq[DROP VIEW $view_name]
push @create, qq[DROP $view_type $view_name]
if $options->{add_drop_view};

push @create, sprintf("CREATE VIEW %s AS\n%s",
push @create, sprintf("CREATE $view_type %s %s AS\n%s",
$view_name,
$view_options,
$view->sql);

return \@create;
Expand Down

0 comments on commit 601e4ea

Please sign in to comment.