I propose this more concise coding for AddDefaultValues, # Now fill in defaults, and note any columns that remain undefined. foreach my $column (@$schema) { my $attname = $column->{name}; my $atttype = $column->{type};
# Skip if a value already exists next if defined $row->{$attname}; # 'oid' and 'relnatts' are special cases. Ignore. next if $attname eq 'oid'; next if $attname eq 'relnatts'; # This column has a default value. Fill it in. if (defined $column->{default}) { $row->{$attname} = $column->{default}; next; } # Failed to find a value. push @missing_fields, $attname; } -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services