45 #include "utils/fmgroids.h"
60 #define MAXTOKENTYPE 256
61 #define MAXDICTSPERTT 100
122 ctl.keysize =
sizeof(
Oid);
144 if (entry == NULL || !entry->
isvalid)
155 elog(
ERROR,
"cache lookup failed for text search parser %u",
163 elog(
ERROR,
"text search parser %u has no prsstart method", prsId);
165 elog(
ERROR,
"text search parser %u has no prstoken method", prsId);
167 elog(
ERROR,
"text search parser %u has no prsend method", prsId);
180 entry->
prsId = prsId;
183 entry->
endOid = prs->prsend;
217 ctl.keysize =
sizeof(
Oid);
241 if (entry == NULL || !entry->
isvalid)
255 elog(
ERROR,
"cache lookup failed for text search dictionary %u",
263 elog(
ERROR,
"text search dictionary %u has no template", dictId);
271 elog(
ERROR,
"cache lookup failed for text search template %u",
279 elog(
ERROR,
"text search template %u has no lexize method",
280 template->tmpllexize);
329 Anum_pg_ts_dict_dictinitoption,
366 ctl.keysize =
sizeof(
Oid);
404 if (entry == NULL || !entry->
isvalid)
425 elog(
ERROR,
"cache lookup failed for text search configuration %u",
433 elog(
ERROR,
"text search configuration %u has no parser", cfgId);
459 entry->
cfgId = cfgId;
460 entry->
prsId = cfg->cfgparser;
471 MemSet(maplists, 0,
sizeof(maplists));
476 Anum_pg_ts_config_map_mapcfg,
488 int toktype = cfgmap->maptokentype;
491 elog(
ERROR,
"maptokentype value %d is out of range", toktype);
492 if (toktype < maxtokentype)
493 elog(
ERROR,
"maptokentype entries are out of order");
494 if (toktype > maxtokentype)
499 maplists[maxtokentype].
len = ndicts;
502 sizeof(
Oid) * ndicts);
503 memcpy(maplists[maxtokentype].dictIds, mapdicts,
504 sizeof(
Oid) * ndicts);
506 maxtokentype = toktype;
507 mapdicts[0] = cfgmap->mapdict;
514 elog(
ERROR,
"too many pg_ts_config_map entries for one token type");
515 mapdicts[ndicts++] = cfgmap->mapdict;
526 maplists[maxtokentype].
len = ndicts;
529 sizeof(
Oid) * ndicts);
530 memcpy(maplists[maxtokentype].dictIds, mapdicts,
531 sizeof(
Oid) * ndicts);
533 entry->
lenmap = maxtokentype + 1;
537 memcpy(entry->
map, maplists,
568 elog(
ERROR,
"text search configuration isn't set");
590 (
Node *) &escontext);
619 (
Node *) &escontext);
634 (
errcode(ERRCODE_UNDEFINED_OBJECT),
635 errmsg(
"text search configuration \"%s\" does not exist", *
newval)));
648 elog(
ERROR,
"cache lookup failed for text search configuration %u",
#define Assert(condition)
#define MemSet(start, val, len)
#define OidIsValid(objectId)
void CreateCacheMemoryContext(void)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt)
#define OidFunctionCall1(functionId, arg1)
SysScanDesc systable_beginscan_ordered(Relation heapRelation, Relation indexRelation, Snapshot snapshot, int nkeys, ScanKey key)
void systable_endscan_ordered(SysScanDesc sysscan)
HeapTuple systable_getnext_ordered(SysScanDesc sysscan, ScanDirection direction)
char * guc_strdup(int elevel, const char *src)
#define HeapTupleIsValid(tuple)
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
void CacheRegisterSyscacheCallback(int cacheid, SyscacheCallbackFunction func, Datum arg)
char * get_namespace_name(Oid nspid)
void MemoryContextReset(MemoryContext context)
void pfree(void *pointer)
void * MemoryContextAlloc(MemoryContext context, Size size)
MemoryContext CacheMemoryContext
void MemoryContextSetIdentifier(MemoryContext context, const char *id)
#define AllocSetContextCreate
#define ALLOCSET_SMALL_SIZES
#define MemoryContextCopyAndSetIdentifier(cxt, id)
Oid get_ts_config_oid(List *names, bool missing_ok)
static rewind_source * source
FormData_pg_ts_config * Form_pg_ts_config
FormData_pg_ts_config_map * Form_pg_ts_config_map
FormData_pg_ts_dict * Form_pg_ts_dict
FormData_pg_ts_parser * Form_pg_ts_parser
FormData_pg_ts_template * Form_pg_ts_template
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
MemoryContextSwitchTo(old_ctx)
static unsigned hash(unsigned *uv, int n)
List * stringToQualifiedNameList(const char *string, Node *escontext)
char * quote_qualified_identifier(const char *qualifier, const char *ident)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
#define BTEqualStrategyNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
static TSDictionaryCacheEntry * lastUsedDictionary
bool check_default_text_search_config(char **newval, void **extra, GucSource source)
Oid getTSCurrentConfig(bool emitError)
TSDictionaryCacheEntry * lookup_ts_dictionary_cache(Oid dictId)
static void InvalidateTSCacheCallBack(Datum arg, int cacheid, uint32 hashvalue)
static void init_ts_config_cache(void)
static HTAB * TSDictionaryCacheHash
static HTAB * TSConfigCacheHash
static TSParserCacheEntry * lastUsedParser
static Oid TSCurrentConfigCache
void assign_default_text_search_config(const char *newval, void *extra)
TSConfigCacheEntry * lookup_ts_config_cache(Oid cfgId)
TSParserCacheEntry * lookup_ts_parser_cache(Oid prsId)
static TSConfigCacheEntry * lastUsedConfig
static HTAB * TSParserCacheHash
struct TSDictionaryCacheEntry TSDictionaryCacheEntry
struct TSParserCacheEntry TSParserCacheEntry
List * deserialize_deflist(Datum txt)
bool IsTransactionState(void)