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

Commit684b4f2

Browse files
committed
Refactor creation of normal dependency records when creating extension
When creating an extension, the same type of dependency is used whenregistering a dependency to a schema and required extensions. Thisimproves the code so as those dependencies are not recorded one-by-one,but grouped together. Note that this has as side effect to removeduplicate dependency entries, even if it should not happen in practiceas extensions listed as required in a control file should be listed onlyonce.Extracted from a larger patch by the same author.Author: Daniel DustafssonDiscussion:https://postgr.es/m/20200629065535.GA183079@paquier.xyz
1 parentc4342c9 commit684b4f2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

‎src/backend/commands/extension.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,7 @@ InsertExtensionTuple(const char *extName, Oid extOwner,
17831783
HeapTupletuple;
17841784
ObjectAddressmyself;
17851785
ObjectAddressnsp;
1786+
ObjectAddresses*refobjs;
17861787
ListCell*lc;
17871788

17881789
/*
@@ -1825,27 +1826,26 @@ InsertExtensionTuple(const char *extName, Oid extOwner,
18251826
*/
18261827
recordDependencyOnOwner(ExtensionRelationId,extensionOid,extOwner);
18271828

1828-
myself.classId=ExtensionRelationId;
1829-
myself.objectId=extensionOid;
1830-
myself.objectSubId=0;
1829+
refobjs=new_object_addresses();
18311830

1832-
nsp.classId=NamespaceRelationId;
1833-
nsp.objectId=schemaOid;
1834-
nsp.objectSubId=0;
1831+
ObjectAddressSet(myself,ExtensionRelationId,extensionOid);
18351832

1836-
recordDependencyOn(&myself,&nsp,DEPENDENCY_NORMAL);
1833+
ObjectAddressSet(nsp,NamespaceRelationId,schemaOid);
1834+
add_exact_object_address(&nsp,refobjs);
18371835

18381836
foreach(lc,requiredExtensions)
18391837
{
18401838
Oidreqext=lfirst_oid(lc);
18411839
ObjectAddressotherext;
18421840

1843-
otherext.classId=ExtensionRelationId;
1844-
otherext.objectId=reqext;
1845-
otherext.objectSubId=0;
1846-
1847-
recordDependencyOn(&myself,&otherext,DEPENDENCY_NORMAL);
1841+
ObjectAddressSet(otherext,ExtensionRelationId,reqext);
1842+
add_exact_object_address(&otherext,refobjs);
18481843
}
1844+
1845+
/* Record all of them (this includes duplicate elimination) */
1846+
record_object_address_dependencies(&myself,refobjs,DEPENDENCY_NORMAL);
1847+
free_object_addresses(refobjs);
1848+
18491849
/* Post creation hook for new extension */
18501850
InvokeObjectPostCreateHook(ExtensionRelationId,extensionOid,0);
18511851

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp