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

Commit7ff9afb

Browse files
committed
Small code simplification
Apply GETSTRUCT() once instead of doing it repeatedly in the samefunction. This simplifies the notation and makes the function'sstructure more similar to the surrounding ones.Discussion:https://www.postgresql.org/message-id/flat/a368248e-69e4-40be-9c07-6c3b5880b0a6@eisentraut.org
1 parent3f28b2f commit7ff9afb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7736,6 +7736,7 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
77367736
const char *colName, LOCKMODE lockmode)
77377737
{
77387738
HeapTupletuple;
7739+
Form_pg_attribute attTup;
77397740
AttrNumberattnum;
77407741
Relationattr_rel;
77417742
ObjectAddress address;
@@ -7753,7 +7754,8 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
77537754
errmsg("column \"%s\" of relation \"%s\" does not exist",
77547755
colName, RelationGetRelationName(rel))));
77557756

7756-
attnum = ((Form_pg_attribute) GETSTRUCT(tuple))->attnum;
7757+
attTup = (Form_pg_attribute) GETSTRUCT(tuple);
7758+
attnum = attTup->attnum;
77577759

77587760
/* Prevent them from altering a system attribute */
77597761
if (attnum <= 0)
@@ -7765,9 +7767,9 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
77657767
/*
77667768
* Okay, actually perform the catalog change ... if needed
77677769
*/
7768-
if (!((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull)
7770+
if (!attTup->attnotnull)
77697771
{
7770-
((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = true;
7772+
attTup->attnotnull = true;
77717773

77727774
CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple);
77737775

@@ -7777,8 +7779,7 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
77777779
* this then we can skip that. We needn't bother looking if we've
77787780
* already found that we must verify some other not-null constraint.
77797781
*/
7780-
if (!tab->verify_new_notnull &&
7781-
!NotNullImpliedByRelConstraints(rel, (Form_pg_attribute) GETSTRUCT(tuple)))
7782+
if (!tab->verify_new_notnull && !NotNullImpliedByRelConstraints(rel, attTup))
77827783
{
77837784
/* Tell Phase 3 it needs to test the constraint */
77847785
tab->verify_new_notnull = true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp