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

Commite26d313

Browse files
committed
Remove useless code
BuildDescForRelation() goes out of its way to fill in->constr->has_not_null, but that value is not used for anything later,so this code can all be removed. Note that BuildDescForRelation()doesn't make any effort to fill in the rest of ->constr, so there isno claim that that structure is completely filled in.Reviewed-by: Tomasz Rybak <tomasz.rybak@post.pl>Discussion:https://www.postgresql.org/message-id/flat/a368248e-69e4-40be-9c07-6c3b5880b0a6@eisentraut.org
1 parentda2aeba commite26d313

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,9 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
12731273
*
12741274
* Given a list of ColumnDef nodes, build a TupleDesc.
12751275
*
1276-
* Note: tdtypeid will need to be filled in later on.
1276+
* Note: This is only for the limited purpose of table and view creation. Not
1277+
* everything is filled in. A real tuple descriptor should be obtained from
1278+
* the relcache.
12771279
*/
12781280
TupleDesc
12791281
BuildDescForRelation(const List *columns)
@@ -1282,7 +1284,6 @@ BuildDescForRelation(const List *columns)
12821284
AttrNumberattnum;
12831285
ListCell *l;
12841286
TupleDescdesc;
1285-
boolhas_not_null;
12861287
char *attname;
12871288
Oidatttypid;
12881289
int32atttypmod;
@@ -1294,7 +1295,6 @@ BuildDescForRelation(const List *columns)
12941295
*/
12951296
natts = list_length(columns);
12961297
desc = CreateTemplateTupleDesc(natts);
1297-
has_not_null = false;
12981298

12991299
attnum = 0;
13001300

@@ -1340,7 +1340,6 @@ BuildDescForRelation(const List *columns)
13401340

13411341
/* Fill in additional stuff not handled by TupleDescInitEntry */
13421342
att->attnotnull = entry->is_not_null;
1343-
has_not_null |= entry->is_not_null;
13441343
att->attislocal = entry->is_local;
13451344
att->attinhcount = entry->inhcount;
13461345
att->attidentity = entry->identity;
@@ -1352,24 +1351,6 @@ BuildDescForRelation(const List *columns)
13521351
att->attstorage = GetAttributeStorage(att->atttypid, entry->storage_name);
13531352
}
13541353

1355-
if (has_not_null)
1356-
{
1357-
TupleConstr *constr = (TupleConstr *) palloc0(sizeof(TupleConstr));
1358-
1359-
constr->has_not_null = true;
1360-
constr->has_generated_stored = false;
1361-
constr->defval = NULL;
1362-
constr->missing = NULL;
1363-
constr->num_defval = 0;
1364-
constr->check = NULL;
1365-
constr->num_check = 0;
1366-
desc->constr = constr;
1367-
}
1368-
else
1369-
{
1370-
desc->constr = NULL;
1371-
}
1372-
13731354
return desc;
13741355
}
13751356

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp