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

Commit25794e8

Browse files
committed
Cosmetic code cleanup in commands/extension.c.
Some of the comments added by the CREATE EXTENSION CASCADE patch werea bit sloppy, and I didn't care for redeclaring the same local variableinside a nested block either. No functional changes.
1 parent2093f66 commit25794e8

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

‎src/backend/commands/extension.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,10 +1169,10 @@ find_update_path(List *evi_list,
11691169
/*
11701170
* CREATE EXTENSION worker
11711171
*
1172-
* When CASCADE is specified CreateExtensionInternal() recurses if required
1173-
* extensions need to be installed. To sanely handle cyclic dependencies
1174-
*cascade_parentcontainsthe dependency chain leading to the current
1175-
*invocation; thusallowing to error out ifthere's a cyclic dependency.
1172+
* When CASCADE is specified, CreateExtensionInternal() recurses if required
1173+
* extensions need to be installed.To sanely handle cyclic dependencies,
1174+
*the "parents" listcontainsa list of names of extensions already being
1175+
*installed,allowingusto error out ifwe recurse to one of those.
11761176
*/
11771177
staticObjectAddress
11781178
CreateExtensionInternal(CreateExtensionStmt*stmt,List*parents)
@@ -1400,8 +1400,8 @@ CreateExtensionInternal(CreateExtensionStmt *stmt, List *parents)
14001400
*/
14011401

14021402
/*
1403-
* Look up the prerequisite extensions,and build lists of their OIDs and
1404-
* the OIDs of their target schemas.
1403+
* Look up the prerequisite extensions,install them if necessary, and
1404+
*build lists of their OIDs andthe OIDs of their target schemas.
14051405
*/
14061406
requiredExtensions=NIL;
14071407
requiredSchemas=NIL;
@@ -1416,18 +1416,19 @@ CreateExtensionInternal(CreateExtensionStmt *stmt, List *parents)
14161416
{
14171417
if (cascade)
14181418
{
1419+
/* Must install it. */
14191420
CreateExtensionStmt*ces;
1420-
ListCell*lc;
1421+
ListCell*lc2;
14211422
ObjectAddressaddr;
14221423
List*cascade_parents;
14231424

1424-
/* Check extension name validity before trying to cascade */
1425+
/* Check extension name validity before trying to cascade. */
14251426
check_valid_extension_name(curreq);
14261427

14271428
/* Check for cyclic dependency between extensions. */
1428-
foreach(lc,parents)
1429+
foreach(lc2,parents)
14291430
{
1430-
char*pname= (char*)lfirst(lc);
1431+
char*pname= (char*)lfirst(lc2);
14311432

14321433
if (strcmp(pname,curreq)==0)
14331434
ereport(ERROR,
@@ -1440,26 +1441,26 @@ CreateExtensionInternal(CreateExtensionStmt *stmt, List *parents)
14401441
(errmsg("installing required extension \"%s\"",
14411442
curreq)));
14421443

1443-
/*Create and execute newCREATE EXTENSION statement. */
1444+
/*Build aCREATE EXTENSION statement to pass down. */
14441445
ces=makeNode(CreateExtensionStmt);
14451446
ces->extname=curreq;
1447+
ces->if_not_exists= false;
14461448

1447-
/* Propagate the CASCADE option */
1449+
/* Propagate the CASCADE option. */
14481450
ces->options=list_make1(d_cascade);
14491451

14501452
/* Propagate the SCHEMA option if given. */
14511453
if (d_schema&&d_schema->arg)
14521454
ces->options=lappend(ces->options,d_schema);
14531455

1454-
/*
1455-
* Pass the current list of parents + the current extension to
1456-
* the "child" CreateExtensionInternal().
1457-
*/
1456+
/* Add current extension to list of parents to pass down. */
14581457
cascade_parents=
14591458
lappend(list_copy(parents),stmt->extname);
14601459

14611460
/* Create the required extension. */
14621461
addr=CreateExtensionInternal(ces,cascade_parents);
1462+
1463+
/* Get its newly-assigned OID. */
14631464
reqext=addr.objectId;
14641465
}
14651466
else
@@ -1551,7 +1552,6 @@ CreateExtension(CreateExtensionStmt *stmt)
15511552
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
15521553
errmsg("nested CREATE EXTENSION is not supported")));
15531554

1554-
15551555
/* Finally create the extension. */
15561556
returnCreateExtensionInternal(stmt,NIL);
15571557
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp