overhaul of index representation: indices (both normal and unique) are now named...
[DBIx-DBSchema.git] / DBSchema / DBD / Pg.pm
index f80dfbc..f593f88 100644 (file)
@@ -5,9 +5,13 @@ use vars qw($VERSION @ISA %typemap);
 use DBD::Pg 1.32;
 use DBIx::DBSchema::DBD;
 
-$VERSION = '0.08';
+$VERSION = '0.11';
 @ISA = qw(DBIx::DBSchema::DBD);
 
+die "DBD::Pg version 1.32 or 1.41 (or later) required--".
+    "this is only version $DBD::Pg::VERSION\n"
+  if $DBD::Pg::VERSION != 1.32 && $DBD::Pg::VERSION < 1.41;
+
 %typemap = (
   'BLOB' => 'BYTEA',
   'LONG VARBINARY' => 'BYTEA',
@@ -31,6 +35,8 @@ This module implements a PostgreSQL-native driver for DBIx::DBSchema.
 
 =cut
 
+sub default_db_schema  { 'public'; }
+
 sub columns {
   my($proto, $dbh, $table) = @_;
   my $sth = $dbh->prepare(<<END) or die $dbh->errstr;
@@ -130,6 +136,7 @@ sub _index_fields {
     FROM pg_class c, pg_attribute a, pg_type t
     WHERE c.relname = '$index'
       AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid
+    ORDER BY a.attnum
 END
   $sth->execute or die $sth->errstr;
   map { $_->{'attname'} } @{ $sth->fetchall_arrayref({}) };