#include "access/gist_private.h" #include "access/htup_details.h" #include "access/reloptions.h" #include "common/pg_prng.h" #include "storage/indexfsm.h" #include "utils/float.h" #include "utils/fmgrprotos.h" #include "utils/lsyscache.h" #include "utils/rel.h" #include "utils/snapmgr.h" #include "utils/syscache.h"">

PostgreSQL Source Code: src/backend/access/gist/gistutil.c File Reference (original) (raw)

#include "[postgres.h](postgres%5F8h%5Fsource.html)"
#include <math.h>
#include "[access/gist_private.h](gist%5F%5Fprivate%5F8h%5Fsource.html)"
#include "[access/htup_details.h](htup%5F%5Fdetails%5F8h%5Fsource.html)"
#include "[access/reloptions.h](reloptions%5F8h%5Fsource.html)"
#include "[common/pg_prng.h](pg%5F%5Fprng%5F8h%5Fsource.html)"
#include "[storage/indexfsm.h](indexfsm%5F8h%5Fsource.html)"
#include "[utils/float.h](float%5F8h%5Fsource.html)"
#include "utils/fmgrprotos.h"
#include "[utils/lsyscache.h](lsyscache%5F8h%5Fsource.html)"
#include "[utils/rel.h](rel%5F8h%5Fsource.html)"
#include "[utils/snapmgr.h](snapmgr%5F8h%5Fsource.html)"
#include "[utils/syscache.h](syscache%5F8h%5Fsource.html)"

Go to the source code of this file.

Functions
void gistfillbuffer (Page page, IndexTuple *itup, int len, OffsetNumber off)
bool gistnospace (Page page, IndexTuple *itvec, int len, OffsetNumber todelete, Size freespace)
bool gistfitpage (IndexTuple *itvec, int len)
IndexTuple * gistextractpage (Page page, int *len)
IndexTuple * gistjoinvector (IndexTuple *itvec, int *len, IndexTuple *additvec, int addlen)
IndexTupleData * gistfillitupvec (IndexTuple *vec, int veclen, int *memlen)
void gistMakeUnionItVec (GISTSTATE *giststate, IndexTuple *itvec, int len, Datum *attr, bool *isnull)
IndexTuple gistunion (Relation r, IndexTuple *itvec, int len, GISTSTATE *giststate)
void gistMakeUnionKey (GISTSTATE *giststate, int attno, GISTENTRY *entry1, bool isnull1, GISTENTRY *entry2, bool isnull2, Datum *dst, bool *dstisnull)
bool gistKeyIsEQ (GISTSTATE *giststate, int attno, Datum a, Datum b)
void gistDeCompressAtt (GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p, OffsetNumber o, GISTENTRY *attdata, bool *isnull)
IndexTuple gistgetadjusted (Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *giststate)
OffsetNumber gistchoose (Relation r, Page p, IndexTuple it, GISTSTATE *giststate)
void gistdentryinit (GISTSTATE *giststate, int nkey, GISTENTRY *e, Datum k, Relation r, Page pg, OffsetNumber o, bool l, bool isNull)
IndexTuple gistFormTuple (GISTSTATE *giststate, Relation r, const Datum *attdata, const bool *isnull, bool isleaf)
void gistCompressValues (GISTSTATE *giststate, Relation r, const Datum *attdata, const bool *isnull, bool isleaf, Datum *compatt)
static Datum gistFetchAtt (GISTSTATE *giststate, int nkey, Datum k, Relation r)
HeapTuple gistFetchTuple (GISTSTATE *giststate, Relation r, IndexTuple tuple)
float gistpenalty (GISTSTATE *giststate, int attno, GISTENTRY *orig, bool isNullOrig, GISTENTRY *add, bool isNullAdd)
void gistinitpage (Page page, uint32 f)
void GISTInitBuffer (Buffer b, uint32 f)
void gistcheckpage (Relation rel, Buffer buf)
Buffer gistNewBuffer (Relation r, Relation heaprel)
bool gistPageRecyclable (Page page)
bytea * gistoptions (Datum reloptions, bool validate)
bool gistproperty (Oid index_oid, int attno, IndexAMProperty prop, const char *propname, bool *res, bool *isnull)
XLogRecPtr gistGetFakeLSN (Relation rel)
Datum gist_stratnum_common (PG_FUNCTION_ARGS)
StrategyNumber gisttranslatecmptype (CompareType cmptype, Oid opfamily)

gist_stratnum_common()

Definition at line 1065 of file gistutil.c.

1066{

1068

1069 switch (cmptype)

1070 {

1085 default:

1087 }

1088}

#define PG_GETARG_INT32(n)

#define PG_RETURN_UINT16(x)

#define RTOverlapStrategyNumber

#define RTEqualStrategyNumber

#define RTLessEqualStrategyNumber

#define RTGreaterEqualStrategyNumber

#define RTGreaterStrategyNumber

#define RTContainedByStrategyNumber

#define RTLessStrategyNumber

References COMPARE_CONTAINED_BY, COMPARE_EQ, COMPARE_GE, COMPARE_GT, COMPARE_LE, COMPARE_LT, COMPARE_OVERLAP, InvalidStrategy, PG_GETARG_INT32, PG_RETURN_UINT16, RTContainedByStrategyNumber, RTEqualStrategyNumber, RTGreaterEqualStrategyNumber, RTGreaterStrategyNumber, RTLessEqualStrategyNumber, RTLessStrategyNumber, and RTOverlapStrategyNumber.

gistcheckpage()

Definition at line 785 of file gistutil.c.

786{

788

789

790

791

792

793

794

797 (errcode(ERRCODE_INDEX_CORRUPTED),

798 errmsg("index \"%s\" contains unexpected zero page at block %u",

801 errhint("Please REINDEX it.")));

802

803

804

805

808 (errcode(ERRCODE_INDEX_CORRUPTED),

809 errmsg("index \"%s\" contains corrupted page at block %u",

812 errhint("Please REINDEX it.")));

813}

BlockNumber BufferGetBlockNumber(Buffer buffer)

static Page BufferGetPage(Buffer buffer)

static uint16 PageGetSpecialSize(const PageData *page)

static bool PageIsNew(const PageData *page)

int errhint(const char *fmt,...)

int errcode(int sqlerrcode)

int errmsg(const char *fmt,...)

#define ereport(elevel,...)

#define RelationGetRelationName(relation)

References buf, BufferGetBlockNumber(), BufferGetPage(), ereport, errcode(), errhint(), errmsg(), ERROR, MAXALIGN, PageGetSpecialSize(), PageIsNew(), and RelationGetRelationName.

Referenced by gistBufferingFindCorrectParent(), gistdoinsert(), gistFindCorrectParent(), gistFindPath(), gistkillitems(), gistNewBuffer(), gistScanPage(), gistvacuum_delete_empty_pages(), and pgstat_gist_page().

gistchoose()

Definition at line 374 of file gistutil.c.

376{

384 int keep_current_best;

385

387

390 identry, isnull);

391

392

394

395

396

397

398

399

400

401

402

403

404

405 best_penalty[0] = -1;

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430 keep_current_best = -1;

431

432

433

434

437

439 {

441 bool zero_penalty;

442 int j;

443

444 zero_penalty = true;

445

446

448 {

450 float usize;

451 bool IsNull;

452

453

455 &IsNull);

457 false, IsNull);

458 usize = gistpenalty(giststate, j, &entry, IsNull,

459 &identry[j], isnull[j]);

460 if (usize > 0)

461 zero_penalty = false;

462

463 if (best_penalty[j] < 0 || usize < best_penalty[j])

464 {

465

466

467

468

469

470

471

472

473 result = i;

474 best_penalty[j] = usize;

475

477 best_penalty[j + 1] = -1;

478

479

480 keep_current_best = -1;

481 }

482 else if (best_penalty[j] == usize)

483 {

484

485

486

487

488

489 }

490 else

491 {

492

493

494

495

496

497 zero_penalty = false;

498 break;

499 }

500 }

501

502

503

504

505

507 {

508 if (keep_current_best == -1)

509 {

510

512 }

513 if (keep_current_best == 0)

514 {

515

516 result = i;

517

518 keep_current_best = -1;

519 }

520 }

521

522

523

524

525

526

527

528 if (zero_penalty)

529 {

530 if (keep_current_best == -1)

531 {

532

534 }

535 if (keep_current_best == 1)

536 break;

537 }

538 }

539

540 return result;

541}

static Item PageGetItem(const PageData *page, const ItemIdData *itemId)

static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)

static OffsetNumber PageGetMaxOffsetNumber(const PageData *page)

#define GistPageIsLeaf(page)

void gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p, OffsetNumber o, GISTENTRY *attdata, bool *isnull)

void gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e, Datum k, Relation r, Page pg, OffsetNumber o, bool l, bool isNull)

float gistpenalty(GISTSTATE *giststate, int attno, GISTENTRY *orig, bool isNullOrig, GISTENTRY *add, bool isNullAdd)

Assert(PointerIsAligned(start, uint64))

IndexTupleData * IndexTuple

static Datum index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)

#define OffsetNumberNext(offsetNumber)

#define FirstOffsetNumber

pg_prng_state pg_global_prng_state

bool pg_prng_bool(pg_prng_state *state)

#define IndexRelationGetNumberOfKeyAttributes(relation)

References Assert(), FirstOffsetNumber, gistDeCompressAtt(), gistdentryinit(), GistPageIsLeaf, gistpenalty(), i, index_getattr(), INDEX_MAX_KEYS, IndexRelationGetNumberOfKeyAttributes, j, GISTSTATE::leafTupdesc, OffsetNumberNext, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), pg_global_prng_state, and pg_prng_bool().

Referenced by gistdoinsert(), and gistProcessItup().

gistCompressValues()

void gistCompressValues ( GISTSTATE * giststate,
Relation r,
const Datum * attdata,
const bool * isnull,
bool isleaf,
Datum * compatt
)

Definition at line 596 of file gistutil.c.

598{

599 int i;

600

601

602

603

605 {

606 if (isnull[i])

607 compatt[i] = (Datum) 0;

608 else

609 {

612

614 isleaf);

615

621 else

622 cep = ¢ry;

623 compatt[i] = cep->key;

624 }

625 }

626

627 if (isleaf)

628 {

629

630

631

633 {

634 if (isnull[i])

635 compatt[i] = (Datum) 0;

636 else

637 compatt[i] = attdata[i];

638 }

639 }

640}

#define OidIsValid(objectId)

Datum FunctionCall1Coll(FmgrInfo *flinfo, Oid collation, Datum arg1)

#define gistentryinit(e, k, r, pg, o, l)

static Datum PointerGetDatum(const void *X)

static Pointer DatumGetPointer(Datum X)

Oid supportCollation[INDEX_MAX_KEYS]

FmgrInfo compressFn[INDEX_MAX_KEYS]

References GISTSTATE::compressFn, DatumGetPointer(), FmgrInfo::fn_oid, FunctionCall1Coll(), gistentryinit, i, IndexRelationGetNumberOfKeyAttributes, GISTENTRY::key, TupleDescData::natts, OidIsValid, PointerGetDatum(), RelationData::rd_att, and GISTSTATE::supportCollation.

Referenced by gistFormTuple(), and gistSortedBuildCallback().

gistDeCompressAtt()

Definition at line 296 of file gistutil.c.

298{

299 int i;

300

302 {

304

307 datum, r, p, o,

308 false, isnull[i]);

309 }

310}

References gistdentryinit(), i, index_getattr(), IndexRelationGetNumberOfKeyAttributes, and GISTSTATE::leafTupdesc.

Referenced by gistchoose(), gistgetadjusted(), gistRelocateBuildBuffersOnSplit(), and placeOne().

gistdentryinit()

Definition at line 547 of file gistutil.c.

550{

551 if (!isNull)

552 {

554

556

557

559 return;

560

565

566 if (dep != e)

569 }

570 else

572}

FmgrInfo decompressFn[INDEX_MAX_KEYS]

References DatumGetPointer(), GISTSTATE::decompressFn, FmgrInfo::fn_oid, FunctionCall1Coll(), gistentryinit, GISTENTRY::key, GISTENTRY::leafkey, GISTENTRY::offset, OidIsValid, GISTENTRY::page, PointerGetDatum(), GISTENTRY::rel, and GISTSTATE::supportCollation.

Referenced by gistchoose(), gistDeCompressAtt(), gistindex_keytest(), gistMakeUnionItVec(), and gistSplitByKey().

gistextractpage()

gistFetchAtt()

gistFetchTuple()

Definition at line 667 of file gistutil.c.

668{

672 int i;

673

675 {

677

679

681 {

682 if (!isnull[i])

684 else

686 }

688 {

689

690

691

692

693 if (!isnull[i])

695 else

697 }

698 else

699 {

700

701

702

703

704

705 isnull[i] = true;

707 }

708 }

709

710

711

712

714 {

716 &isnull[i]);

717 }

719

721}

static Datum gistFetchAtt(GISTSTATE *giststate, int nkey, Datum k, Relation r)

HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)

static MemoryContext MemoryContextSwitchTo(MemoryContext context)

References GISTSTATE::compressFn, fetchatt, GISTSTATE::fetchFn, GISTSTATE::fetchTupdesc, FmgrInfo::fn_oid, gistFetchAtt(), heap_form_tuple(), i, index_getattr(), INDEX_MAX_KEYS, IndexRelationGetNumberOfKeyAttributes, InvalidOid, GISTSTATE::leafTupdesc, MemoryContextSwitchTo(), TupleDescData::natts, RelationData::rd_att, and GISTSTATE::tempCxt.

Referenced by gistScanPage().

gistfillbuffer()

Definition at line 34 of file gistutil.c.

35{

36 int i;

37

41

42 for (i = 0; i < len; i++)

43 {

46

49 elog(ERROR, "failed to add item to GiST index page, item %d out of %d, size %d bytes",

50 i, len, (int) sz);

51 off++;

52 }

53}

static bool PageIsEmpty(const PageData *page)

#define PageAddItem(page, item, size, offsetNumber, overwrite, is_heap)

static Size IndexTupleSize(const IndexTupleData *itup)

#define InvalidOffsetNumber

References elog, ERROR, FirstOffsetNumber, i, IndexTupleSize(), InvalidOffsetNumber, len, OffsetNumberNext, PageAddItem, PageGetMaxOffsetNumber(), and PageIsEmpty().

Referenced by gist_indexsortbuild_levelstate_add(), gistplacetopage(), and gistRedoPageSplitRecord().

gistfillitupvec()

gistfitpage()

gistFormTuple()

Definition at line 575 of file gistutil.c.

577{

580

582

585 compatt, isnull);

586

587

588

589

590

592 return res;

593}

void gistCompressValues(GISTSTATE *giststate, Relation r, const Datum *attdata, const bool *isnull, bool isleaf, Datum *compatt)

IndexTuple index_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)

static void ItemPointerSetOffsetNumber(ItemPointerData *pointer, OffsetNumber offsetNumber)

References gistCompressValues(), index_form_tuple(), INDEX_MAX_KEYS, ItemPointerSetOffsetNumber(), GISTSTATE::leafTupdesc, GISTSTATE::nonLeafTupdesc, and IndexTupleData::t_tid.

Referenced by gistBuildCallback(), gistgetadjusted(), gistinsert(), gistSplit(), and gistunion().

gistgetadjusted()

Definition at line 316 of file gistutil.c.

317{

318 bool neednew = false;

326 int i;

327

330

333

335 {

337 oldentries + i, oldisnull[i],

338 addentries + i, addisnull[i],

339 attr + i, isnull + i);

340

341 if (neednew)

342

343 continue;

344

345 if (isnull[i])

346

347 continue;

348

349 if (!addisnull[i])

350 {

351 if (oldisnull[i] ||

353 neednew = true;

354 }

355 }

356

357 if (neednew)

358 {

359

360 newtup = gistFormTuple(giststate, r, attr, isnull, false);

362 }

363

364 return newtup;

365}

void gistMakeUnionKey(GISTSTATE *giststate, int attno, GISTENTRY *entry1, bool isnull1, GISTENTRY *entry2, bool isnull2, Datum *dst, bool *dstisnull)

bool gistKeyIsEQ(GISTSTATE *giststate, int attno, Datum a, Datum b)

IndexTuple gistFormTuple(GISTSTATE *giststate, Relation r, const Datum *attdata, const bool *isnull, bool isleaf)

References gistDeCompressAtt(), gistFormTuple(), gistKeyIsEQ(), gistMakeUnionKey(), i, INDEX_MAX_KEYS, IndexRelationGetNumberOfKeyAttributes, sort-test::key, and IndexTupleData::t_tid.

Referenced by gistdoinsert(), gistformdownlink(), gistProcessItup(), and gistRelocateBuildBuffersOnSplit().

gistGetFakeLSN()

Definition at line 1016 of file gistutil.c.

1017{

1018 if (rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP)

1019 {

1020

1021

1022

1023

1025

1026 return counter++;

1027 }

1029 {

1030

1031

1032

1033

1034

1035

1038

1039

1041

1042

1045

1046 lastlsn = currlsn;

1047 return currlsn;

1048 }

1049 else

1050 {

1051

1052

1053

1054

1055 Assert(rel->rd_rel->relpersistence == RELPERSISTENCE_UNLOGGED);

1057 }

1058}

XLogRecPtr gistXLogAssignLSN(void)

#define RelationNeedsWAL(relation)

#define RelationIsPermanent(relation)

XLogRecPtr GetXLogInsertRecPtr(void)

XLogRecPtr GetFakeLSNForUnloggedRel(void)

#define FirstNormalUnloggedLSN

#define XLogRecPtrIsInvalid(r)

#define InvalidXLogRecPtr

References Assert(), FirstNormalUnloggedLSN, GetFakeLSNForUnloggedRel(), GetXLogInsertRecPtr(), gistXLogAssignLSN(), InvalidXLogRecPtr, RelationData::rd_rel, RelationIsPermanent, RelationNeedsWAL, and XLogRecPtrIsInvalid.

Referenced by gistdeletepage(), gistplacetopage(), gistprunepage(), gistvacuumpage(), and gistvacuumscan().

GISTInitBuffer()

gistinitpage()

Definition at line 757 of file gistutil.c.

758{

760

762

765 opaque->flags = f;

767}

#define InvalidBlockNumber

void PageInit(Page page, Size pageSize, Size specialSize)

#define GistPageGetOpaque(page)

References GISTPageOpaqueData::flags, GISTPageOpaqueData::gist_page_id, GIST_PAGE_ID, GistPageGetOpaque, InvalidBlockNumber, PageInit(), and GISTPageOpaqueData::rightlink.

Referenced by gist_indexsortbuild(), gist_indexsortbuild_levelstate_add(), gist_indexsortbuild_levelstate_flush(), and GISTInitBuffer().

gistjoinvector()

gistKeyIsEQ()

Definition at line 281 of file gistutil.c.

282{

283 bool result = false;

284

287 a, b,

289 return result;

290}

Datum FunctionCall3Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2, Datum arg3)

FmgrInfo equalFn[INDEX_MAX_KEYS]

References a, b, GISTSTATE::equalFn, FunctionCall3Coll(), PointerGetDatum(), and GISTSTATE::supportCollation.

Referenced by gistgetadjusted(), and gistUserPicksplit().

gistMakeUnionItVec()

Definition at line 155 of file gistutil.c.

157{

158 int i;

160 int attrsize;

161

163

165 {

166 int j;

167

168

169 evec->n = 0;

170 for (j = 0; j < len; j++)

171 {

173 bool IsNull;

174

176 &IsNull);

177 if (IsNull)

178 continue;

179

182 datum,

184 false, IsNull);

185 evec->n++;

186 }

187

188

189 if (evec->n == 0)

190 {

192 isnull[i] = true;

193 }

194 else

195 {

196 if (evec->n == 1)

197 {

198

199 evec->n = 2;

201 }

202

203

208

209 isnull[i] = false;

210 }

211 }

212}

Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)

struct GISTENTRY GISTENTRY

FmgrInfo unionFn[INDEX_MAX_KEYS]

GISTENTRY vector[FLEXIBLE_ARRAY_MEMBER]

References FunctionCall2Coll(), GEVHDRSZ, gistdentryinit(), i, index_getattr(), j, GISTSTATE::leafTupdesc, len, GistEntryVector::n, TupleDescData::natts, GISTSTATE::nonLeafTupdesc, palloc(), PointerGetDatum(), GISTSTATE::supportCollation, GISTSTATE::unionFn, and GistEntryVector::vector.

Referenced by gistunion(), and gistunionsubkeyvec().

gistMakeUnionKey()

gistNewBuffer()

Definition at line 824 of file gistutil.c.

825{

827

828

829 for (;;)

830 {

832

834 break;

835

837

838

839

840

841

843 {

845

846

847

848

850 return buffer;

851

853

854

855

856

857

859 {

860

861

862

863

864

865

868

869 return buffer;

870 }

871

873 }

874

875

877 }

878

879

882

883 return buffer;

884}

Buffer ExtendBufferedRel(BufferManagerRelation bmr, ForkNumber forkNum, BufferAccessStrategy strategy, uint32 flags)

bool ConditionalLockBuffer(Buffer buffer)

void ReleaseBuffer(Buffer buffer)

void LockBuffer(Buffer buffer, int mode)

Buffer ReadBuffer(Relation reln, BlockNumber blockNum)

static FullTransactionId GistPageGetDeleteXid(Page page)

bool gistPageRecyclable(Page page)

void gistcheckpage(Relation rel, Buffer buf)

void gistXLogPageReuse(Relation rel, Relation heaprel, BlockNumber blkno, FullTransactionId deleteXid)

BlockNumber GetFreeIndexPage(Relation rel)

#define XLogStandbyInfoActive()

References BMR_REL, BufferGetPage(), ConditionalLockBuffer(), EB_LOCK_FIRST, ExtendBufferedRel(), GetFreeIndexPage(), GIST_UNLOCK, gistcheckpage(), GistPageGetDeleteXid(), gistPageRecyclable(), gistXLogPageReuse(), InvalidBlockNumber, LockBuffer(), MAIN_FORKNUM, PageIsNew(), ReadBuffer(), RelationNeedsWAL, ReleaseBuffer(), and XLogStandbyInfoActive.

Referenced by gistbuild(), and gistplacetopage().

gistnospace()

gistoptions()

bytea * gistoptions ( Datum reloptions,
bool validate
)

Definition at line 912 of file gistutil.c.

913{

917 };

918

923}

static bool validate(Port *port, const char *auth)

void * build_reloptions(Datum reloptions, bool validate, relopt_kind kind, Size relopt_struct_size, const relopt_parse_elt *relopt_elems, int num_relopt_elems)

References build_reloptions(), fillfactor, lengthof, RELOPT_KIND_GIST, RELOPT_TYPE_ENUM, RELOPT_TYPE_INT, and validate().

Referenced by gisthandler().

gistPageRecyclable()

bool gistPageRecyclable ( Page page )

gistpenalty()

gistproperty()

bool gistproperty ( Oid index_oid,
int attno,
IndexAMProperty prop,
const char * propname,
bool * res,
bool * isnull
)

Definition at line 933 of file gistutil.c.

936{

937 Oid opclass,

938 opfamily,

939 opcintype;

941

942

943 if (attno == 0)

944 return false;

945

946

947

948

949

950

951

952

953

954

955

956

957 switch (prop)

958 {

961 break;

964 break;

965 default:

966 return false;

967 }

968

969

972 {

973 *isnull = true;

974 return true;

975 }

976

977

979 {

980 *isnull = true;

981 return true;

982 }

983

984

985

991

992

993

994

995

997 {

1003 }

1004

1005 *isnull = false;

1006

1007 return true;

1008}

@ AMPROP_DISTANCE_ORDERABLE

#define GIST_COMPRESS_PROC

#define GIST_DISTANCE_PROC

bool get_opclass_opfamily_and_input_type(Oid opclass, Oid *opfamily, Oid *opcintype)

Oid get_index_column_opclass(Oid index_oid, int attno)

static Datum Int16GetDatum(int16 X)

static Datum ObjectIdGetDatum(Oid X)

#define SearchSysCacheExists4(cacheId, key1, key2, key3, key4)

References AMPROP_DISTANCE_ORDERABLE, AMPROP_RETURNABLE, get_index_column_opclass(), get_opclass_opfamily_and_input_type(), GIST_COMPRESS_PROC, GIST_DISTANCE_PROC, GIST_FETCH_PROC, Int16GetDatum(), ObjectIdGetDatum(), OidIsValid, and SearchSysCacheExists4.

Referenced by gisthandler().

gisttranslatecmptype()

Definition at line 1098 of file gistutil.c.

1099{

1100 Oid funcid;

1102

1103

1107

1108

1111}

Datum OidFunctionCall1Coll(Oid functionId, Oid collation, Datum arg1)

#define GIST_STRATNUM_PROC

Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)

static uint16 DatumGetUInt16(Datum X)

static Datum Int32GetDatum(int32 X)

References DatumGetUInt16(), get_opfamily_proc(), GIST_STRATNUM_PROC, Int32GetDatum(), InvalidOid, InvalidStrategy, OidFunctionCall1Coll(), and OidIsValid.

Referenced by gisthandler().

gistunion()

Definition at line 219 of file gistutil.c.

220{

223

225

226 return gistFormTuple(giststate, r, attr, isnull, false);

227}

void gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, Datum *attr, bool *isnull)

References gistFormTuple(), gistMakeUnionItVec(), INDEX_MAX_KEYS, and len.

Referenced by gist_indexsortbuild_levelstate_flush().