Re: assert pg_class.relnatts is consistent
| От | Alvaro Herrera |
|---|---|
| Тема | Re: assert pg_class.relnatts is consistent |
| Дата | |
| Msg-id | 20200214151301.GA6618@alvherre.pgsql обсуждение исходный текст |
| Ответ на | Re: assert pg_class.relnatts is consistent (Amit Langote <amitlangote09@gmail.com>) |
| Список | pgsql-hackers |
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
В списке pgsql-hackers по дате отправления: