*** pgsql/src/backend/access/gin/ginutil.c 2009/01/05 17:14:28 1.20 --- pgsql/src/backend/access/gin/ginutil.c 2009/03/24 20:17:11 1.21 *************** *** 8,14 **** * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/access/gin/ginutil.c,v 1.19 2009/01/01 17:23:34 momjian Exp $ *------------------------------------------------------------------------- */ --- 8,14 ---- * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/access/gin/ginutil.c,v 1.20 2009/01/05 17:14:28 alvherre Exp $ *------------------------------------------------------------------------- */ *************** initGinState(GinState *state, Relation i *** 57,63 **** CurrentMemoryContext); /* ! * Check opclass capability to do partial match. */ if ( index_getprocid(index, i+1, GIN_COMPARE_PARTIAL_PROC) != InvalidOid ) { --- 57,63 ---- CurrentMemoryContext); /* ! * Check opclass capability to do partial match. */ if ( index_getprocid(index, i+1, GIN_COMPARE_PARTIAL_PROC) != InvalidOid ) { *************** gintuple_get_attrnum(GinState *ginstate, *** 88,94 **** bool isnull; /* ! * First attribute is always int16, so we can safely use any * tuple descriptor to obtain first attribute of tuple */ res = index_getattr(tuple, FirstOffsetNumber, ginstate->tupdesc[0], --- 88,94 ---- bool isnull; /* ! * First attribute is always int16, so we can safely use any * tuple descriptor to obtain first attribute of tuple */ res = index_getattr(tuple, FirstOffsetNumber, ginstate->tupdesc[0], *************** GinInitBuffer(Buffer b, uint32 f) *** 213,218 **** --- 213,234 ---- GinInitPage(BufferGetPage(b), f, BufferGetPageSize(b)); } + void + GinInitMetabuffer(Buffer b) + { + GinMetaPageData *metadata; + Page page = BufferGetPage(b); + + GinInitPage(page, GIN_META, BufferGetPageSize(b)); + + metadata = GinPageGetMeta(page); + + metadata->head = metadata->tail = InvalidBlockNumber; + metadata->tailFreeSize = 0; + metadata->nPendingPages = 0; + metadata->nPendingHeapTuples = 0; + } + int compareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, Datum b) { *************** ginoptions(PG_FUNCTION_ARGS) *** 315,324 **** { Datum reloptions = PG_GETARG_DATUM(0); bool validate = PG_GETARG_BOOL(1); ! bytea *result; ! result = default_reloptions(reloptions, validate, RELOPT_KIND_GIN); ! if (result) ! PG_RETURN_BYTEA_P(result); ! PG_RETURN_NULL(); } --- 331,356 ---- { Datum reloptions = PG_GETARG_DATUM(0); bool validate = PG_GETARG_BOOL(1); ! relopt_value *options; ! GinOptions *rdopts; ! int numoptions; ! static const relopt_parse_elt tab[] = { ! {"fastupdate", RELOPT_TYPE_BOOL, offsetof(GinOptions, useFastUpdate)} ! }; ! ! options = parseRelOptions(reloptions, validate, RELOPT_KIND_GIN, ! &numoptions); ! ! /* if none set, we're done */ ! if (numoptions == 0) ! PG_RETURN_NULL(); ! ! rdopts = allocateReloptStruct(sizeof(GinOptions), options, numoptions); ! ! fillRelOptions((void *) rdopts, sizeof(GinOptions), options, numoptions, ! validate, tab, lengthof(tab)); ! ! pfree(options); ! PG_RETURN_BYTEA_P(rdopts); }