Subject: | PostgreSQL producer ignores views... (PATCH) |
Patch attached...
--
www.jasonkohles.com
Subject: | postgresql-view.patch |
Index: PostgreSQL.pm
===================================================================
--- PostgreSQL.pm (revision 1377)
+++ PostgreSQL.pm (working copy)
@@ -208,12 +208,20 @@
}
+ my @views = map { create_view( $_ ) } $schema->get_views;
+
$output = join("\n\n", @table_defs);
if ( @fks ) {
$output .= "--\n-- Foreign Key Definitions\n--\n\n" unless $no_comments;
$output .= join( "\n\n", @fks ) . "\n";
}
+ if ( @views ) {
+ $output .= "--\n-- View Definitions\n--\n\n" unless $no_comments;
+ $output .= join( "\n\n", @views )."\n";
+ }
+
+
if ( $WARN ) {
if ( %truncated ) {
warn "Truncated " . keys( %truncated ) . " names:\n";
@@ -741,6 +749,15 @@
return $out;
}
+sub create_view {
+ my $view = shift;
+
+ ( my $sql = $view->sql ) =~ s/^/ /gm;
+
+ return sprintf( "CREATE VIEW %s AS\n%s;", $view->name, $sql );
+}
+
+
1;
# -------------------------------------------------------------------