use base 'DBIx::Class::Schema::Loader::DBI::Component::QuotedDefault';
use mro 'c3';
-our $VERSION = '0.07043';
+our $VERSION = '0.07047';
=head1 NAME
WHERE typname = ?
EOF
if ($typetype && $typetype eq 'e') {
- # The following will extract a list of allowed values for the
- # enum.
+ # The following will extract a list of allowed values for the enum.
my $order_column = $self->dbh->{pg_server_version} >= 90100 ? 'enumsortorder' : 'oid';
- my $typevalues = $self->dbh
- ->selectall_arrayref(<<EOF, {}, $info->{data_type});
+ $info->{extra}{list} = $self->dbh
+ ->selectcol_arrayref(<<EOF, {}, $info->{data_type});
SELECT e.enumlabel
FROM pg_catalog.pg_enum e
JOIN pg_catalog.pg_type t ON t.oid = e.enumtypid
ORDER BY e.$order_column
EOF
- $info->{extra}{list} = [ map { $_->[0] } @$typevalues ];
-
# Store its original name in extra for SQLT to pick up.
$info->{extra}{custom_type_name} = $info->{data_type};
return $result;
}
+sub _view_definition {
+ my ($self, $view) = @_;
+
+ my $def = $self->schema->storage->dbh->selectrow_array(<<'EOF', {}, $view->schema, $view->name);
+SELECT pg_catalog.pg_get_viewdef(oid)
+FROM pg_catalog.pg_class
+WHERE relnamespace = (SELECT OID FROM pg_catalog.pg_namespace WHERE nspname = ?)
+AND relname = ?
+EOF
+ # The definition is returned as a complete statement including the
+ # trailing semicolon, but that's not allowed in CREATE VIEW, so
+ # strip it out
+ $def =~ s/\s*;\s*\z//;
+ return $def;
+}
+
=head1 SEE ALSO
L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,