1 package DBIx::Class::Schema::Loader::Pg;
5 use base 'DBIx::Class::Schema::Loader::Generic';
9 DBIx::Class::Schema::Loader::Pg - DBIx::Class::Schema::Loader Postgres Implementation.
13 use DBIx::Class::Schema::Loader;
15 # $loader is a DBIx::Class::Schema::Loader::Pg
16 my $loader = DBIx::Class::Schema::Loader->new(
17 dsn => "dbi:Pg:dbname=dbname",
24 See L<DBIx::Class::Schema::Loader>.
29 return qw/DBIx::Class::PK::Auto::Pg/;
34 my $dbh = $self->schema->storage->dbh;
35 my $quoter = $dbh->get_info(29) || q{"};
37 # This is split out to avoid version parsing errors...
38 my $is_dbd_pg_gte_131 = ( $DBD::Pg::VERSION >= 1.31 );
39 my @tables = $is_dbd_pg_gte_131
40 ? $dbh->tables( undef, $self->db_schema, "",
41 "table", { noprefix => 1, pg_noprefix => 1 } )
44 s/$quoter//g for @tables;
49 my ( $self, $table ) = @_;
50 my $dbh = $self->schema->storage->dbh;
51 my $quoter = $dbh->get_info(29) || q{"};
53 my $sth = $dbh->column_info(undef, $self->db_schema, $table, undef);
54 my @cols = map { $_->[3] } @{ $sth->fetchall_arrayref };
55 s/$quoter//g for @cols;
57 my @primary = $dbh->primary_key(undef, $self->db_schema, $table);
59 s/$quoter//g for @primary;
61 return ( \@cols, \@primary );
66 L<DBIx::Class::Schema::Loader>