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

Commitb747010

Browse files
committed
In initdb, defend against assignment of NULL values to not-null columns.
Previously, you could write _null_ in a BKI DATA line for a column that'ssupposed to be NOT NULL and initdb would let it pass, probably breakingsubsequent accesses to the row. No doubt the original coding overlookedthis simple sanity check because in the beginning we didn't have any wayto mark catalog columns NOT NULL at initdb time.
1 parentf2a8861 commitb747010

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

‎src/backend/bootstrap/bootstrap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,11 @@ InsertOneNull(int i)
843843
{
844844
elog(DEBUG4,"inserting column %d NULL",i);
845845
Assert(i >=0&&i<MAXATTR);
846+
if (boot_reldesc->rd_att->attrs[i]->attnotnull)
847+
elog(ERROR,
848+
"NULL value specified for not-null column \"%s\" of relation \"%s\"",
849+
NameStr(boot_reldesc->rd_att->attrs[i]->attname),
850+
RelationGetRelationName(boot_reldesc));
846851
values[i]=PointerGetDatum(NULL);
847852
Nulls[i]= true;
848853
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp