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

Commit7b96519

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 parente0b268f commit7b96519

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
@@ -480,7 +480,11 @@ TypeCreate(Oid newTypeOid,
480480
*
481481
* If rebuild is true, we remove existing dependencies and rebuild them
482482
* from scratch. This is needed for ALTER TYPE, and also when replacing
483-
* a shell type.
483+
* a shell type. We don't remove an existing extension dependency, though.
484+
* (That means an extension can't absorb a shell type created in another
485+
* extension, nor ALTER a type created by another extension. Also, if it
486+
* replaces a free-standing shell type or ALTERs a free-standing type,
487+
* that type will become a member of the extension.)
484488
*/
485489
void
486490
GenerateTypeDependencies(OidtypeNamespace,
@@ -505,6 +509,7 @@ GenerateTypeDependencies(Oid typeNamespace,
505509
ObjectAddressmyself,
506510
referenced;
507511

512+
/* If rebuild, first flush old dependencies, except extension deps */
508513
if (rebuild)
509514
{
510515
deleteDependencyRecordsFor(TypeRelationId,typeObjectId, true);
@@ -516,7 +521,7 @@ GenerateTypeDependencies(Oid typeNamespace,
516521
myself.objectSubId=0;
517522

518523
/*
519-
* Makedependency on namespace and shared dependency onowner.
524+
* Makedependencies on namespace,owner, extension.
520525
*
521526
* For a relation rowtype (that's not a composite type), we should skip
522527
* these because we'll depend on them indirectly through the pg_class
@@ -532,10 +537,9 @@ GenerateTypeDependencies(Oid typeNamespace,
532537
recordDependencyOn(&myself,&referenced,DEPENDENCY_NORMAL);
533538

534539
recordDependencyOnOwner(TypeRelationId,typeObjectId,owner);
535-
}
536540

537-
/* dependency on extension */
538-
recordDependencyOnCurrentExtension(&myself,rebuild);
541+
recordDependencyOnCurrentExtension(&myself,rebuild);
542+
}
539543

540544
/* Normal dependencies on the I/O functions */
541545
if (OidIsValid(inputProcedure))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp