Hi.

The current DBIx::Class fails to ->create() stuff when the table is in a
schema that isn't in the default search path.

This patch makes the Auto sequence stuff work when the table resides in a
schemas that's not in the default search path too. (does not change the
current behaviour). The patch to the test makes the test pass.


Index: t/run/12pg.tl
===================================================================
--- t/run/12pg.tl       (revision 1502)
+++ t/run/12pg.tl       (working copy)
@@ -50,7 +50,7 @@
 my $type_info = PgTest->schema->storage->columns_info_for('artist');
 my $artistid_defval = delete $type_info->{artistid}->{default_value};
 like($artistid_defval,
-     qr/^nextval\('public\.artist_artistid_seq'::(?:text|regclass)\)/,
+     qr/^nextval\('artist_artistid_seq'::(?:text|regclass)\)/,
      'columns_info_for - sequence matches Pg get_autoinc_seq expectations');
 is_deeply($type_info, $test_type_info,
           'columns_info_for - column data types');
Index: lib/DBIx/Class/Storage/DBI/Pg.pm
===================================================================
--- lib/DBIx/Class/Storage/DBI/Pg.pm    (revision 1502)
+++ lib/DBIx/Class/Storage/DBI/Pg.pm    (working copy)
@@ -25,7 +25,7 @@
     if (defined $info->[12] and $info->[12] =~
       /^nextval\(+'([^']+)'::(?:text|regclass)\)/)
     {
-      return $1; # may need to strip quotes -- see if this works
+      return $schema ? $schema . "." . $1 : $1 ; # may need to strip
quotes -- see if this works
     }
   }
 }

Jesper

-- 
Jesper Krogh


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/

Reply via email to