* basic operation on PossibleValueSet: add a value to the set field of PossibleValueSet * * The caller must verify that the valueToCopy is greenplum hashable */
| 178 | * The caller must verify that the valueToCopy is greenplum hashable |
| 179 | */ |
| 180 | static void |
| 181 | AddValue(PossibleValueSet *pvs, Const *valueToCopy) |
| 182 | { |
| 183 | if (pvs->set == NULL) |
| 184 | { |
| 185 | Assert(pvs->memoryContext == NULL); |
| 186 | |
| 187 | pvs->memoryContext = AllocSetContextCreate(CurrentMemoryContext, |
| 188 | "PossibleValueSet", |
| 189 | ALLOCSET_DEFAULT_MINSIZE, |
| 190 | ALLOCSET_DEFAULT_INITSIZE, |
| 191 | ALLOCSET_DEFAULT_MAXSIZE); |
| 192 | pvs->set = CreateNodeSetHashTable(pvs->memoryContext); |
| 193 | } |
| 194 | |
| 195 | if (!ContainsValue(pvs, valueToCopy)) |
| 196 | { |
| 197 | bool found; /* unused but needed in call */ |
| 198 | MemoryContext oldContext = MemoryContextSwitchTo(pvs->memoryContext); |
| 199 | |
| 200 | Const *key = copyObject(valueToCopy); |
| 201 | ConstHashValue *entry = hash_search(pvs->set, &key, HASH_ENTER, &found); |
| 202 | |
| 203 | entry->c = key; |
| 204 | |
| 205 | MemoryContextSwitchTo(oldContext); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | static void |
| 210 | SetToNoValuesPossible(PossibleValueSet *pvs) |
no test coverage detected