Package: libclass-dbi-perl
Version: 0.96-1
Severity: normal
Tags: patch

If a value is not specified for a PK column when creating a Class::DBI
object, Class::DBI attempts to insert a row with NULL as the "value" for
this column.  This works with MySQL auto-id columns, since MySQL ignores
the bogus NULL, but does not work with PostgreSQL's auto-id ("serial")
columns; the NULL overrides the default.

This appears to be an unintended result of the following test in the
_init subroutine:

       if (@primary_columns == grep defined, @[EMAIL PROTECTED]) {

If I'm not mistaken, this assigns undef/NULL to each missing PK column
and then checks whether each PK column has a value matching its name!  I
believe this is actually meant to check that each PK column has been
given a value, which I think should be written:

       if (@primary_columns == grep exists $data->{$_}, @primary_columns) {

Secondly the _auto_increment_value subroutine doesn't work with
PostgreSQL.  The appropriate expression is:

    $dbh->last_insert_id(undef, undef, $self->table, undef)

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.16-1-k7
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages libclass-dbi-perl depends on:
ii  libclass-accessor-perl        0.22-1     Automated accessor generator
ii  libclass-data-inheritable-per 0.04-1     Inheritable, overridable class dat
ii  libclass-trigger-perl         0.10-1     Mix-in to add / call inheritable t
ii  libima-dbi-perl               0.34-1     Database connection caching and or
ii  libuniversal-moniker-perl     0.08-2     Nicer names for your Perl modules/
ii  perl                          5.8.8-4    Larry Wall's Practical Extraction 

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to