@@ -41,10 +41,11 @@ Oid binary_upgrade_next_pg_enum_oid = InvalidOid;
41
41
* committed; otherwise, they might get into indexes where we can't clean
42
42
* them up, and then if the transaction rolls back we have a broken index.
43
43
* (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.
46
47
*/
47
- static HTAB * enum_blacklist = NULL ;
48
+ static HTAB * uncommitted_enums = NULL ;
48
49
49
50
static void RenumberEnumType (Relation pg_enum , HeapTuple * existing , int nelems );
50
51
static int sort_order_cmp (const void * p1 , const void * p2 );
@@ -181,20 +182,20 @@ EnumValuesDelete(Oid enumTypeOid)
181
182
}
182
183
183
184
/*
184
- * Initialize the enum blacklist for this transaction.
185
+ * Initialize the uncommitted enum table for this transaction.
185
186
*/
186
187
static void
187
- init_enum_blacklist (void )
188
+ init_uncommitted_enums (void )
188
189
{
189
190
HASHCTL hash_ctl ;
190
191
191
192
hash_ctl .keysize = sizeof (Oid );
192
193
hash_ctl .entrysize = sizeof (Oid );
193
194
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 );
198
199
}
199
200
200
201
/*
@@ -490,12 +491,12 @@ AddEnumLabel(Oid enumTypeOid,
490
491
491
492
table_close (pg_enum , RowExclusiveLock );
492
493
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 ();
496
497
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 );
499
500
}
500
501
501
502
@@ -584,19 +585,19 @@ RenameEnumLabel(Oid enumTypeOid,
584
585
585
586
586
587
/*
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.
588
589
*/
589
590
bool
590
- EnumBlacklisted (Oid enum_id )
591
+ EnumUncommitted (Oid enum_id )
591
592
{
592
593
bool found ;
593
594
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 )
596
597
return false;
597
598
598
599
/* 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 );
600
601
return found ;
601
602
}
602
603
@@ -608,11 +609,11 @@ void
608
609
AtEOXact_Enum (void )
609
610
{
610
611
/*
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.
612
613
* The memory will go away automatically when TopTransactionContext is
613
614
* freed; it's sufficient to clear our pointer.
614
615
*/
615
- enum_blacklist = NULL ;
616
+ uncommitted_enums = NULL ;
616
617
}
617
618
618
619
@@ -691,12 +692,12 @@ sort_order_cmp(const void *p1, const void *p2)
691
692
}
692
693
693
694
Size
694
- EstimateEnumBlacklistSpace (void )
695
+ EstimateUncommittedEnumsSpace (void )
695
696
{
696
697
size_t entries ;
697
698
698
- if (enum_blacklist )
699
- entries = hash_get_num_entries (enum_blacklist );
699
+ if (uncommitted_enums )
700
+ entries = hash_get_num_entries (uncommitted_enums );
700
701
else
701
702
entries = 0 ;
702
703
@@ -705,23 +706,23 @@ EstimateEnumBlacklistSpace(void)
705
706
}
706
707
707
708
void
708
- SerializeEnumBlacklist (void * space , Size size )
709
+ SerializeUncommittedEnums (void * space , Size size )
709
710
{
710
711
Oid * serialized = (Oid * ) space ;
711
712
712
713
/*
713
714
* Make sure the hash table hasn't changed in size since the caller
714
715
* reserved the space.
715
716
*/
716
- Assert (size == EstimateEnumBlacklistSpace ());
717
+ Assert (size == EstimateUncommittedEnumsSpace ());
717
718
718
719
/* Write out all the values from the hash table, if there is one. */
719
- if (enum_blacklist )
720
+ if (uncommitted_enums )
720
721
{
721
722
HASH_SEQ_STATUS status ;
722
723
Oid * value ;
723
724
724
- hash_seq_init (& status , enum_blacklist );
725
+ hash_seq_init (& status , uncommitted_enums );
725
726
while ((value = (Oid * ) hash_seq_search (& status )))
726
727
* serialized ++ = * value ;
727
728
}
@@ -737,11 +738,11 @@ SerializeEnumBlacklist(void *space, Size size)
737
738
}
738
739
739
740
void
740
- RestoreEnumBlacklist (void * space )
741
+ RestoreUncommittedEnums (void * space )
741
742
{
742
743
Oid * serialized = (Oid * ) space ;
743
744
744
- Assert (!enum_blacklist );
745
+ Assert (!uncommitted_enums );
745
746
746
747
/*
747
748
* As a special case, if the list is empty then don't even bother to
@@ -752,9 +753,9 @@ RestoreEnumBlacklist(void *space)
752
753
return ;
753
754
754
755
/* Read all the values into a new hash table. */
755
- init_enum_blacklist ();
756
+ init_uncommitted_enums ();
756
757
do
757
758
{
758
- hash_search (enum_blacklist , serialized ++ , HASH_ENTER , NULL );
759
+ hash_search (uncommitted_enums , serialized ++ , HASH_ENTER , NULL );
759
760
} while (OidIsValid (* serialized ));
760
761
}
0 commit comments