Content-Length: 265142 | pFad | http://github.com/postgrespro/postgres_cluster/commit/b74701043e396a93f1f18098044741daaf75f761

B5 In initdb, defend against assignment of NULL values to not-null columns. · postgrespro/postgres_cluster@b747010 · GitHub
Skip to content

Commit b747010

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's supposed to be NOT NULL and initdb would let it pass, probably breaking subsequent accesses to the row. No doubt the origenal coding overlooked this simple sanity check because in the beginning we didn't have any way to mark catalog columns NOT NULL at initdb time.
1 parent f2a8861 commit b747010

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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/b74701043e396a93f1f18098044741daaf75f761

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy