| 352 | |
| 353 | |
| 354 | static IndexAmRoutine * |
| 355 | GetRumIndexHandler(PG_FUNCTION_ARGS) |
| 356 | { |
| 357 | IndexAmRoutine *indexRoutine = palloc0(sizeof(IndexAmRoutine)); |
| 358 | |
| 359 | EnsureRumLibLoaded(); |
| 360 | *indexRoutine = rum_index_routine; |
| 361 | |
| 362 | /* add a new proc as a config prog. */ |
| 363 | /* Based on https://github.com/postgrespro/rum/blob/master/src/rumutil.c#L117 */ |
| 364 | /* AMsupport is the index of the largest support function. We point to the options proc */ |
| 365 | uint16 RUMNProcs = indexRoutine->amsupport; |
| 366 | if (RUMNProcs < 11) |
| 367 | { |
| 368 | indexRoutine->amsupport = RUMNProcs + 1; |
| 369 | |
| 370 | /* register the user config proc number. */ |
| 371 | /* based on https://github.com/postgrespro/rum/blob/master/src/rum.h#L837 */ |
| 372 | /* RUMNprocs is the count, and the highest function supported */ |
| 373 | /* We set our config proc to be one above that */ |
| 374 | indexRoutine->amoptsprocnum = RUMNProcs + 1; |
| 375 | } |
| 376 | |
| 377 | indexRoutine->ambeginscan = extension_rumbeginscan; |
| 378 | indexRoutine->amrescan = extension_rumrescan; |
| 379 | indexRoutine->amgetbitmap = extension_amgetbitmap; |
| 380 | indexRoutine->amgettuple = extension_amgettuple; |
| 381 | indexRoutine->amendscan = extension_rumendscan; |
| 382 | indexRoutine->amcostestimate = extension_rumcostestimate; |
| 383 | indexRoutine->ambuild = extension_rumbuild; |
| 384 | indexRoutine->aminsert = extension_ruminsert; |
| 385 | indexRoutine->amcanreturn = NULL; |
| 386 | |
| 387 | return indexRoutine; |
| 388 | } |
| 389 | |
| 390 | |
| 391 | void |
no test coverage detected