ts_init_dict_hook.diff

application/octet-stream

Filename: ts_init_dict_hook.diff
Type: application/octet-stream
Part: 0
Message: proposal: tsearch dictionary initialization hook

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
File+
src/backend/utils/cache/ts_cache.c 11 3
src/include/tsearch/ts_cache.h 5 0
*** ./src/backend/utils/cache/ts_cache.c.orig	2010-08-05 17:25:35.000000000 +0200
--- ./src/backend/utils/cache/ts_cache.c	2010-09-05 08:25:00.958285837 +0200
***************
*** 76,81 ****
--- 76,83 ----
  
  static Oid	TSCurrentConfigCache = InvalidOid;
  
+ /* hook to preparing tseach dictionary to work */
+ init_ts_dictionary_hook_type init_ts_dictionary_hook = NULL;
  
  /*
   * We use this syscache callback to detect when a visible change to a TS
***************
*** 336,344 ****
  			else
  				dictoptions = deserialize_deflist(opt);
  
! 			entry->dictData =
! 				DatumGetPointer(OidFunctionCall1(template->tmplinit,
! 											  PointerGetDatum(dictoptions)));
  
  			MemoryContextSwitchTo(oldcontext);
  		}
--- 338,352 ----
  			else
  				dictoptions = deserialize_deflist(opt);
  
! 			if (init_ts_dictionary_hook)
! 			{
! 				entry->dictData = 
! 					(*init_ts_dictionary_hook)(template->tmplinit, dictoptions);
! 			}
! 			else
! 				entry->dictData =
! 					DatumGetPointer(OidFunctionCall1(template->tmplinit,
! 												  PointerGetDatum(dictoptions)));
  
  			MemoryContextSwitchTo(oldcontext);
  		}
*** ./src/include/tsearch/ts_cache.h.orig	2010-01-02 17:58:09.000000000 +0100
--- ./src/include/tsearch/ts_cache.h	2010-09-05 08:16:05.683832929 +0200
***************
*** 81,86 ****
--- 81,91 ----
  	ListDictionary *map;
  } TSConfigCacheEntry;
  
+ typedef void *(*init_ts_dictionary_hook_type) (Oid tmpinit,
+ 							    List *dictoptions);
+ 
+ extern PGDLLIMPORT init_ts_dictionary_hook_type init_ts_dictionary;
+ 
  
  /*
   * GUC variable for current configuration