1 package DBIx::Class::PK::Auto::Pg;
6 use base qw/DBIx::Class/;
8 __PACKAGE__->load_components(qw/PK::Auto/);
12 $self->get_autoinc_seq unless $self->{_autoinc_seq};
13 $self->storage->dbh->last_insert_id(undef,undef,undef,undef,
14 {sequence=>$self->{_autoinc_seq}});
20 # return the user-defined sequence if known
21 if ($self->sequence) {
22 return $self->{_autoinc_seq} = $self->sequence;
25 my $dbh= $self->storage->dbh;
26 my $sth = $dbh->column_info( undef, undef, $self->_table_name, '%');
27 while (my $foo = $sth->fetchrow_arrayref){
28 if(defined $foo->[12] && $foo->[12] =~ /^nextval/) {
29 ($self->{_autoinc_seq}) = $foo->[12] =~
30 m!^nextval\('"?([^"']+)"?'::text\)!;
39 DBIx::Class::PK::Auto::Pg- Automatic Primary Key class for Postgresql
45 This class implements autoincrements for Postgresql.
49 Marcus Ramberg <m.ramberg@cpan.org>
53 You may distribute this code under the same terms as Perl itself.