Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
F.56. tsearch2
Prev UpAppendix F. Additional Supplied ModulesHome Next

F.56. tsearch2

Thetsearch2 module provides backwards-compatible text search functionality for applications that usedtsearch2 before text searching was integrated into corePostgreSQL in release 8.3.

F.56.1. Portability Issues

Although the built-in text search features were based ontsearch2 and are largely similar to it, there are numerous small differences that will create portability issues for existing applications:

  • Some functions' names were changed, for examplerank tots_rank. The replacementtsearch2 module provides aliases having the old names.

  • The built-in text search data types and functions all exist within the system schemapg_catalog. In an installation usingtsearch2, these objects would usually have been in thepublic schema, though some users chose to place them in a separate schema of their own. Explicitly schema-qualified references to the objects will therefore fail in either case. The replacementtsearch2 module provides alias objects that are stored inpublic (or another schema if necessary) so that such references will still work.

  • There is no concept of acurrent parser orcurrent dictionary in the built-in text search features, only of a current search configuration (set by thedefault_text_search_config parameter). While the current parser and current dictionary were used only by functions intended for debugging, this might still pose a porting obstacle in some cases. The replacementtsearch2 module emulates these additional state variables and provides backwards-compatible functions for setting and retrieving them.

There are some issues that are not addressed by the replacementtsearch2 module, and will therefore require application code changes in any case:

  • The oldtsearch2 trigger function allowed items in its argument list to be names of functions to be invoked on the text data before it was converted totsvector format. This was removed as being a security hole, since it was not possible to guarantee that the function invoked was the one intended. The recommended approach if the data must be massaged before being indexed is to write a custom trigger that does the work for itself.

  • Text search configuration information has been moved into core system catalogs that are noticeably different from the tables used bytsearch2. Any applications that examined or modified those tables will need adjustment.

  • If an application used any custom text search configurations, those will need to be set up in the core catalogs using the new text search configuration SQL commands. The replacementtsearch2 module offers a little bit of support for this by making it possible to load an old set oftsearch2 configuration tables intoPostgreSQL 8.3. (Without the module, it is not possible to load the configuration data because values in theregprocedure columns cannot be resolved to functions.) While those configuration tables won't actuallydo anything, at least their contents will be available to be consulted while setting up an equivalent custom configuration in 8.3.

  • The oldreset_tsearch() andget_covers() functions are not supported.

  • The replacementtsearch2 module does not define any alias operators, relying entirely on the built-in ones. This would only pose an issue if an application used explicitly schema-qualified operator names, which is very uncommon.

F.56.2. Converting a pre-8.3 Installation

The recommended way to update a pre-8.3 installation that usestsearch2 is:

  1. Make a dump from the old installation in the usual way, but be sure not to use-c (--clean) option ofpg_dump orpg_dumpall.

  2. In the new installation, create empty database(s) and install the replacementtsearch2 module into each database that will use text search. This must be donebefore loading the dump data! If your old installation had thetsearch2 objects in a schema other thanpublic, be sure to adjust theCREATE EXTENSION command so that the replacement objects are created in that same schema.

  3. Load the dump data. There will be quite a few errors reported due to failure to recreate the originaltsearch2 objects. These errors can be ignored, but this means you cannot restore the dump in a single transaction (eg, you cannot usepg_restore's-1 switch).

  4. Examine the contents of the restoredtsearch2 configuration tables (pg_ts_cfg and so on), and create equivalent built-in text search configurations as needed. You may drop the old configuration tables once you've extracted all the useful information from them.

  5. Test your application.

At a later time you may wish to rename application references to the alias text search objects, so that you can eventually uninstall the replacementtsearch2 module.

F.56.3. References

Tsearch2 Development Sitehttp://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/


Prev Home Next
F.55. test_decoding Up F.57. tsm_system_rows
pdfepub
Go to Postgres Pro Standard 9.6
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp