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

Commite1e1b52

Browse files
committed
Don't mark auto-generated types as extension members.
Relation rowtypes and automatically-generated array types do not need tohave their own extension membership dependency entries. If we create suchthen it becomes more difficult to remove items from an extension, and it'salso harder for an extension upgrade script to make sure it duplicates thedependencies created by the extension's regular installation script.I changed the code in such a way that this happened in commit988cccc, I think because of worries aboutthe shell-type-replacement case; but that cure was worse than the disease.It would only matter if one extension created a shell type that wasreplaced with an auto-generated type in another extension, which seemspretty far-fetched. Better to make this work unsurprisingly in normalcases.Report and patch by Robert Haas, comment adjustments by me.
1 parentdbd35a9 commite1e1b52

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

‎src/backend/catalog/pg_type.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,11 @@ TypeCreate(Oid newTypeOid,
484484
*
485485
* If rebuild is true, we remove existing dependencies and rebuild them
486486
* from scratch. This is needed for ALTER TYPE, and also when replacing
487-
* a shell type.
487+
* a shell type. We don't remove an existing extension dependency, though.
488+
* (That means an extension can't absorb a shell type created in another
489+
* extension, nor ALTER a type created by another extension. Also, if it
490+
* replaces a free-standing shell type or ALTERs a free-standing type,
491+
* that type will become a member of the extension.)
488492
*/
489493
void
490494
GenerateTypeDependencies(OidtypeNamespace,
@@ -509,6 +513,7 @@ GenerateTypeDependencies(Oid typeNamespace,
509513
ObjectAddressmyself,
510514
referenced;
511515

516+
/* If rebuild, first flush old dependencies, except extension deps */
512517
if (rebuild)
513518
{
514519
deleteDependencyRecordsFor(TypeRelationId,typeObjectId, true);
@@ -520,7 +525,7 @@ GenerateTypeDependencies(Oid typeNamespace,
520525
myself.objectSubId=0;
521526

522527
/*
523-
* Makedependency on namespace and shared dependency onowner.
528+
* Makedependencies on namespace,owner, extension.
524529
*
525530
* For a relation rowtype (that's not a composite type), we should skip
526531
* these because we'll depend on them indirectly through the pg_class
@@ -536,10 +541,9 @@ GenerateTypeDependencies(Oid typeNamespace,
536541
recordDependencyOn(&myself,&referenced,DEPENDENCY_NORMAL);
537542

538543
recordDependencyOnOwner(TypeRelationId,typeObjectId,owner);
539-
}
540544

541-
/* dependency on extension */
542-
recordDependencyOnCurrentExtension(&myself,rebuild);
545+
recordDependencyOnCurrentExtension(&myself,rebuild);
546+
}
543547

544548
/* Normal dependencies on the I/O functions */
545549
if (OidIsValid(inputProcedure))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp