Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9d1ec5a

Browse files
committed
Clarify coding in Catalog::AddDefaultValues.
Make it a bit shorter and better-commented; no functional change.Alvaro Herrera and Tom LaneDiscussion:https://postgr.es/m/20200212182337.GZ1412@telsasoft.com
1 parentb78542b commit9d1ec5a

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

‎src/backend/catalog/Catalog.pm

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -331,25 +331,22 @@ sub AddDefaultValues
331331
foreachmy$column (@$schema)
332332
{
333333
my$attname =$column->{name};
334-
my$atttype =$column->{type};
335334

336-
if (defined$row->{$attname})
337-
{
338-
;
339-
}
340-
elsif ($attnameeq'oid')
341-
{
342-
;
343-
}
344-
elsif (defined$column->{default})
335+
# No work if field already has a value.
336+
nextifdefined$row->{$attname};
337+
338+
# Ignore 'oid' columns, they're handled elsewhere.
339+
nextif$attnameeq'oid';
340+
341+
# If column has a default value, fill that in.
342+
if (defined$column->{default})
345343
{
346344
$row->{$attname} =$column->{default};
345+
next;
347346
}
348-
else
349-
{
350-
# Failed to find a value.
351-
push@missing_fields,$attname;
352-
}
347+
348+
# Failed to find a value for this field.
349+
push@missing_fields,$attname;
353350
}
354351

355352
# Failure to provide all columns is a hard error.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp