@@ -41,10 +41,11 @@ Oid binary_upgrade_next_pg_enum_oid = InvalidOid;
4141 * committed; otherwise, they might get into indexes where we can't clean
4242 * them up, and then if the transaction rolls back we have a broken index.
4343 * (See comments for check_safe_enum_use() in enum.c.) Values created by
44- * EnumValuesCreate are *not* blacklisted; we assume those are created during
45- * CREATE TYPE, so they can't go away unless the enum type itself does.
44+ * EnumValuesCreate are *not* entered into the table; we assume those are
45+ * created during CREATE TYPE, so they can't go away unless the enum type
46+ * itself does.
4647 */
47- static HTAB * enum_blacklist = NULL ;
48+ static HTAB * uncommitted_enums = NULL ;
4849
4950static void RenumberEnumType (Relation pg_enum , HeapTuple * existing , int nelems );
5051static int sort_order_cmp (const void * p1 , const void * p2 );
@@ -181,20 +182,20 @@ EnumValuesDelete(Oid enumTypeOid)
181182}
182183
183184/*
184- * Initialize the enum blacklist for this transaction.
185+ * Initialize the uncommitted enum table for this transaction.
185186 */
186187static void
187- init_enum_blacklist (void )
188+ init_uncommitted_enums (void )
188189{
189190 HASHCTL hash_ctl ;
190191
191192 hash_ctl .keysize = sizeof (Oid );
192193 hash_ctl .entrysize = sizeof (Oid );
193194 hash_ctl .hcxt = TopTransactionContext ;
194- enum_blacklist = hash_create ("Enum value blacklist " ,
195- 32 ,
196- & hash_ctl ,
197- HASH_ELEM | HASH_BLOBS | HASH_CONTEXT );
195+ uncommitted_enums = hash_create ("Uncommitted enums " ,
196+ 32 ,
197+ & hash_ctl ,
198+ HASH_ELEM | HASH_BLOBS | HASH_CONTEXT );
198199}
199200
200201/*
@@ -490,12 +491,12 @@ AddEnumLabel(Oid enumTypeOid,
490491
491492 table_close (pg_enum , RowExclusiveLock );
492493
493- /* Set up the blacklist hash if not already done in this transaction */
494- if (enum_blacklist == NULL )
495- init_enum_blacklist ();
494+ /* Set up the uncommitted enum table if not already done in this tx */
495+ if (uncommitted_enums == NULL )
496+ init_uncommitted_enums ();
496497
497- /* Add the new value to the blacklist */
498- (void ) hash_search (enum_blacklist , & newOid , HASH_ENTER , NULL );
498+ /* Add the new value to the table */
499+ (void ) hash_search (uncommitted_enums , & newOid , HASH_ENTER , NULL );
499500}
500501
501502
@@ -584,19 +585,19 @@ RenameEnumLabel(Oid enumTypeOid,
584585
585586
586587/*
587- * Test if the given enum value is on the blacklist
588+ * Test if the given enum value is in the table of uncommitted enums.
588589 */
589590bool
590- EnumBlacklisted (Oid enum_id )
591+ EnumUncommitted (Oid enum_id )
591592{
592593 bool found ;
593594
594- /* If we've made no blacklist table, all values are safe */
595- if (enum_blacklist == NULL )
595+ /* If we've made no uncommitted table, all values are safe */
596+ if (uncommitted_enums == NULL )
596597 return false;
597598
598599 /* Else, is it in the table? */
599- (void ) hash_search (enum_blacklist , & enum_id , HASH_FIND , & found );
600+ (void ) hash_search (uncommitted_enums , & enum_id , HASH_FIND , & found );
600601 return found ;
601602}
602603
@@ -608,11 +609,11 @@ void
608609AtEOXact_Enum (void )
609610{
610611 /*
611- * Reset the blacklist table, as all our enum values are now committed.
612+ * Reset the uncommitted table, as all our enum values are now committed.
612613 * The memory will go away automatically when TopTransactionContext is
613614 * freed; it's sufficient to clear our pointer.
614615 */
615- enum_blacklist = NULL ;
616+ uncommitted_enums = NULL ;
616617}
617618
618619
@@ -691,12 +692,12 @@ sort_order_cmp(const void *p1, const void *p2)
691692}
692693
693694Size
694- EstimateEnumBlacklistSpace (void )
695+ EstimateUncommittedEnumsSpace (void )
695696{
696697 size_t entries ;
697698
698- if (enum_blacklist )
699- entries = hash_get_num_entries (enum_blacklist );
699+ if (uncommitted_enums )
700+ entries = hash_get_num_entries (uncommitted_enums );
700701 else
701702 entries = 0 ;
702703
@@ -705,23 +706,23 @@ EstimateEnumBlacklistSpace(void)
705706}
706707
707708void
708- SerializeEnumBlacklist (void * space , Size size )
709+ SerializeUncommittedEnums (void * space , Size size )
709710{
710711 Oid * serialized = (Oid * ) space ;
711712
712713 /*
713714 * Make sure the hash table hasn't changed in size since the caller
714715 * reserved the space.
715716 */
716- Assert (size == EstimateEnumBlacklistSpace ());
717+ Assert (size == EstimateUncommittedEnumsSpace ());
717718
718719 /* Write out all the values from the hash table, if there is one. */
719- if (enum_blacklist )
720+ if (uncommitted_enums )
720721 {
721722 HASH_SEQ_STATUS status ;
722723 Oid * value ;
723724
724- hash_seq_init (& status , enum_blacklist );
725+ hash_seq_init (& status , uncommitted_enums );
725726 while ((value = (Oid * ) hash_seq_search (& status )))
726727 * serialized ++ = * value ;
727728 }
@@ -737,11 +738,11 @@ SerializeEnumBlacklist(void *space, Size size)
737738}
738739
739740void
740- RestoreEnumBlacklist (void * space )
741+ RestoreUncommittedEnums (void * space )
741742{
742743 Oid * serialized = (Oid * ) space ;
743744
744- Assert (!enum_blacklist );
745+ Assert (!uncommitted_enums );
745746
746747 /*
747748 * As a special case, if the list is empty then don't even bother to
@@ -752,9 +753,9 @@ RestoreEnumBlacklist(void *space)
752753 return ;
753754
754755 /* Read all the values into a new hash table. */
755- init_enum_blacklist ();
756+ init_uncommitted_enums ();
756757 do
757758 {
758- hash_search (enum_blacklist , serialized ++ , HASH_ENTER , NULL );
759+ hash_search (uncommitted_enums , serialized ++ , HASH_ENTER , NULL );
759760 } while (OidIsValid (* serialized ));
760761}
0 commit comments