* _bitmap_insert_lov() -- insert a new data into the given heap and index. */
| 327 | * _bitmap_insert_lov() -- insert a new data into the given heap and index. |
| 328 | */ |
| 329 | void |
| 330 | _bitmap_insert_lov(Relation lovHeap, Relation lovIndex, Datum *datum, |
| 331 | bool *nulls, bool use_wal pg_attribute_unused()) |
| 332 | { |
| 333 | TupleDesc tupDesc; |
| 334 | HeapTuple tuple; |
| 335 | bool result; |
| 336 | Datum *indexDatum; |
| 337 | bool *indexNulls; |
| 338 | |
| 339 | tupDesc = RelationGetDescr(lovHeap); |
| 340 | |
| 341 | /* insert this tuple into the heap */ |
| 342 | tuple = heap_form_tuple(tupDesc, datum, nulls); |
| 343 | simple_heap_insert(lovHeap, tuple); |
| 344 | |
| 345 | /* insert a new tuple into the index */ |
| 346 | indexDatum = palloc0((tupDesc->natts - 2) * sizeof(Datum)); |
| 347 | indexNulls = palloc0((tupDesc->natts - 2) * sizeof(bool)); |
| 348 | memcpy(indexDatum, datum, (tupDesc->natts - 2) * sizeof(Datum)); |
| 349 | memcpy(indexNulls, nulls, (tupDesc->natts - 2) * sizeof(bool)); |
| 350 | result = index_insert(lovIndex, indexDatum, indexNulls, |
| 351 | &(tuple->t_self), lovHeap, true, false, NULL); |
| 352 | |
| 353 | #ifdef FAULT_INJECTOR |
| 354 | FaultInjector_InjectFaultIfSet( |
| 355 | "insert_bmlov_before_freeze", |
| 356 | DDLNotSpecified, |
| 357 | "", //databaseName |
| 358 | RelationGetRelationName(lovHeap)); |
| 359 | #endif |
| 360 | /* freeze the tuple */ |
| 361 | heap_freeze_tuple_wal_logged(lovHeap, tuple); |
| 362 | |
| 363 | #ifdef FAULT_INJECTOR |
| 364 | FaultInjector_InjectFaultIfSet( |
| 365 | "insert_bmlov_after_freeze", |
| 366 | DDLNotSpecified, |
| 367 | "", //databaseName |
| 368 | RelationGetRelationName(lovHeap)); |
| 369 | #endif |
| 370 | pfree(indexDatum); |
| 371 | pfree(indexNulls); |
| 372 | Assert(result); |
| 373 | |
| 374 | heap_freetuple(tuple); |
| 375 | } |
| 376 | |
| 377 | |
| 378 | /* |
no test coverage detected