on postgres, schema module incorrectly signals a comparison mismatch for columns that have a negative default value, because of the enclosing brackets.
for instance, a mismatch is reported for the schema_version column in the system table. its default value is -1, posgres stores this as (-1), thus causing the intval or floatval conversion to fail, leading to a false postive mismatch for that table.

this could be fixed by trimming the enclosing brackets if it is determined the column is numeric :

from schema_pgsql.inc:

//...
if ($numeric) {
        // $col['default'] is currently a string.  If the column is
        // numeric, use intval() or floatval() to extract the value as a
        // numeric type.
        
        // trim brackets surrounding negative default column value
        // to ensure intval or floatval conversion succeeds.
        $col['default']=trim($col['default'],"()");
        
        // more pgsql-specific stuff
        
        if (strpos($col['default'], 'nextval(\'') !== FALSE &&
        //....

observed and tested on winxp-postgres 8.3.5-drupal 6.x.dev tarball from today.

CommentFileSizeAuthor
#1 schema-pg-negative-default.patch646 bytesSteve Simms

Comments

Steve Simms’s picture

Status: Active » Needs review
StatusFileSize
new646 bytes

I ran into the same problem, and can confirm that the fix works. I've attached a patch that does the same thing as the above, adjusted to match Drupal's coding standards.

RockyRoad’s picture

I find this issue just after posting two alternative patches for the same issue, on
#386966: Evaluation of default field values in pgsql.

Sorry for the duplicate.

mikeryan’s picture

Status: Needs review » Closed (duplicate)