-
Notifications
You must be signed in to change notification settings - Fork 34
Description
We recently had a test that does a schema diff start failing after updating to DBD::Pg 3.19. I don't have a golf and can't give you the full error output, but the failures essentially look like this:
| - size => [8, 2],\n | | |
| + size => [undef, "ARRAY(0x5ddd837dfa08)"],\n | | |
I suspect it was due to bucardo/dbdpg#162 I fed the information to claude code and it suggested the following:
Old DBD::Pg returns COLUMN_SIZE="2,8" and DECIMAL_DIGITS=undef. Since DECIMAL_DIGITS is undef, Schema Loader passes the string "2,8" to the Pg layer, which splits it into [8, 2].
New DBD::Pg (PR #162) returns COLUMN_SIZE=8 and DECIMAL_DIGITS=2 as separate integers. Since both are defined, the base Schema Loader layer pre-builds size=[8, 2] as an arrayref before the Pg layer sees it. The Pg layer then tries to regex-substitute that arrayref, which stringifies it to "ARRAY(0x...)", and the split produces [undef, "ARRAY(0x...)"]
It also suggested the following change to DBIx::Class::Schema::Loader::DBI::Pg::_columns_info_for:
elsif ( $data_type =~ /^(?:numeric|decimal)\z/i
&& ( my $size = $info->{size} ) )
{
if (ref $size eq 'ARRAY') {
# New DBD::Pg (PR #162+): base layer already built [precision, scale]
# from separate COLUMN_SIZE and DECIMAL_DIGITS fields — use as-is
}
else {
# Old DBD::Pg: COLUMN_SIZE was "scale,precision" combined string
$size =~ s/\s*//g;
my ( $scale, $precision ) = split /,/, $size;
$info->{size} = [ $precision, $scale ];
}
}
To be clear I haven't looked at these suggestions (particularly the suggested fix) in depth, but the root cause does seem to align.