2 Appendix F. Additional Supplied Modules and Extensions
6 F.1. amcheck — tools to verify table and index consistency
9 F.1.2. Optional heapallindexed Verification
10 F.1.3. Using amcheck Effectively
11 F.1.4. Repairing Corruption
13 F.2. auth_delay — pause on authentication failure
15 F.2.1. Configuration Parameters
18 F.3. auto_explain — log execution plans of slow queries
20 F.3.1. Configuration Parameters
24 F.4. basebackup_to_shell — example "shell" pg_basebackup module
26 F.4.1. Configuration Parameters
29 F.5. basic_archive — an example WAL archive module
31 F.5.1. Configuration Parameters
35 F.6. bloom — bloom filter index access method
39 F.6.3. Operator Class Interface
43 F.7. btree_gin — GIN operator classes with B-tree behavior
48 F.8. btree_gist — GiST operator classes with B-tree behavior
53 F.9. citext — a case-insensitive character string type
57 F.9.3. String Comparison Behavior
61 F.10. cube — a multi-dimensional cube data type
70 F.11. dblink — connect to other PostgreSQL databases
72 dblink_connect — opens a persistent connection to a remote
75 dblink_connect_u — opens a persistent connection to a remote
78 dblink_disconnect — closes a persistent connection to a remote
81 dblink — executes a query in a remote database
82 dblink_exec — executes a command in a remote database
83 dblink_open — opens a cursor in a remote database
84 dblink_fetch — returns rows from an open cursor in a remote
87 dblink_close — closes a cursor in a remote database
88 dblink_get_connections — returns the names of all open named
91 dblink_error_message — gets last error message on the named
94 dblink_send_query — sends an async query to a remote database
95 dblink_is_busy — checks if connection is busy with an async query
96 dblink_get_notify — retrieve async notifications on a connection
97 dblink_get_result — gets an async query result
98 dblink_cancel_query — cancels any active query on the named
101 dblink_get_pkey — returns the positions and field names of a
102 relation's primary key fields
104 dblink_build_sql_insert — builds an INSERT statement using a local
105 tuple, replacing the primary key field values with
106 alternative supplied values
108 dblink_build_sql_delete — builds a DELETE statement using supplied
109 values for primary key field values
111 dblink_build_sql_update — builds an UPDATE statement using a local
112 tuple, replacing the primary key field values with
113 alternative supplied values
115 F.12. dict_int — example full-text search dictionary for integers
117 F.12.1. Configuration
120 F.13. dict_xsyn — example synonym full-text search dictionary
122 F.13.1. Configuration
125 F.14. earthdistance — calculate great-circle distances
127 F.14.1. Cube-Based Earth Distances
128 F.14.2. Point-Based Earth Distances
130 F.15. file_fdw — access data files in the server's file system
131 F.16. fuzzystrmatch — determine string similarities and distance
134 F.16.2. Daitch-Mokotoff Soundex
137 F.16.5. Double Metaphone
139 F.17. hstore — hstore key/value datatype
141 F.17.1. hstore External Representation
142 F.17.2. hstore Operators and Functions
146 F.17.6. Compatibility
150 F.18. intagg — integer aggregator and enumerator
155 F.19. intarray — manipulate arrays of integers
157 F.19.1. intarray Functions and Operators
158 F.19.2. Index Support
163 F.20. isn — data types for international standard numbers (ISBN, EAN,
168 F.20.3. Functions and Operators
169 F.20.4. Configuration Parameters
174 F.21. lo — manage large objects
177 F.21.2. How to Use It
181 F.22. ltree — hierarchical tree-like data type
184 F.22.2. Operators and Functions
190 F.23. pageinspect — low-level inspection of database pages
192 F.23.1. General Functions
193 F.23.2. Heap Functions
194 F.23.3. B-Tree Functions
195 F.23.4. BRIN Functions
196 F.23.5. GIN Functions
197 F.23.6. GiST Functions
198 F.23.7. Hash Functions
200 F.24. passwordcheck — verify password strength
202 F.24.1. Configuration Parameters
204 F.25. pg_buffercache — inspect PostgreSQL buffer cache state
206 F.25.1. The pg_buffercache View
207 F.25.2. The pg_buffercache_numa View
208 F.25.3. The pg_buffercache_summary() Function
209 F.25.4. The pg_buffercache_usage_counts() Function
210 F.25.5. The pg_buffercache_evict() Function
211 F.25.6. The pg_buffercache_evict_relation() Function
212 F.25.7. The pg_buffercache_evict_all() Function
213 F.25.8. Sample Output
216 F.26. pgcrypto — cryptographic functions
218 F.26.1. General Hashing Functions
219 F.26.2. Password Hashing Functions
220 F.26.3. PGP Encryption Functions
221 F.26.4. Raw Encryption Functions
222 F.26.5. Random-Data Functions
223 F.26.6. OpenSSL Support Functions
224 F.26.7. Configuration Parameters
228 F.27. pg_freespacemap — examine the free space map
231 F.27.2. Sample Output
234 F.28. pg_logicalinspect — logical decoding components inspection
239 F.29. pg_overexplain — allow EXPLAIN to dump even more details
241 F.29.1. EXPLAIN (DEBUG)
242 F.29.2. EXPLAIN (RANGE_TABLE)
245 F.30. pg_prewarm — preload relation data into buffer caches
248 F.30.2. Configuration Parameters
251 F.31. pgrowlocks — show a table's row locking information
254 F.31.2. Sample Output
257 F.32. pg_stat_statements — track statistics of SQL planning and
260 F.32.1. The pg_stat_statements View
261 F.32.2. The pg_stat_statements_info View
263 F.32.4. Configuration Parameters
264 F.32.5. Sample Output
267 F.33. pgstattuple — obtain tuple-level statistics
272 F.34. pg_surgery — perform low-level surgery on relation data
277 F.35. pg_trgm — support for similarity of text using trigram matching
279 F.35.1. Trigram (or Trigraph) Concepts
280 F.35.2. Functions and Operators
281 F.35.3. GUC Parameters
282 F.35.4. Index Support
283 F.35.5. Text Search Integration
287 F.36. pg_visibility — visibility map information and utilities
292 F.37. pg_walinspect — low-level WAL inspection
294 F.37.1. General Functions
297 F.38. postgres_fdw — access data stored in external PostgreSQL servers
299 F.38.1. FDW Options of postgres_fdw
301 F.38.3. Connection Management
302 F.38.4. Transaction Management
303 F.38.5. Remote Query Optimization
304 F.38.6. Remote Query Execution Environment
305 F.38.7. Cross-Version Compatibility
307 F.38.9. Configuration Parameters
311 F.39. seg — a datatype for line segments or floating point intervals
320 F.40. sepgsql — SELinux-, label-based mandatory access control (MAC)
325 F.40.3. Regression Tests
326 F.40.4. GUC Parameters
328 F.40.6. Sepgsql Functions
330 F.40.8. External Resources
333 F.41. spi — Server Programming Interface features/examples
335 F.41.1. refint — Functions for Implementing Referential Integrity
336 F.41.2. autoinc — Functions for Autoincrementing Fields
337 F.41.3. insert_username — Functions for Tracking Who Changed a
340 F.41.4. moddatetime — Functions for Tracking Last Modification
343 F.42. sslinfo — obtain client SSL information
345 F.42.1. Functions Provided
348 F.43. tablefunc — functions that return tables (crosstab and others)
350 F.43.1. Functions Provided
353 F.44. tcn — a trigger function to notify listeners of changes to table
356 F.45. test_decoding — SQL-based test/example module for WAL logical
359 F.46. tsm_system_rows — the SYSTEM_ROWS sampling method for TABLESAMPLE
363 F.47. tsm_system_time — the SYSTEM_TIME sampling method for TABLESAMPLE
367 F.48. unaccent — a text search dictionary which removes diacritics
369 F.48.1. Configuration
373 F.49. uuid-ossp — a UUID generator
375 F.49.1. uuid-ossp Functions
376 F.49.2. Building uuid-ossp
379 F.50. xml2 — XPath querying and XSLT functionality
381 F.50.1. Deprecation Notice
382 F.50.2. Description of Functions
384 F.50.4. XSLT Functions
387 This appendix and the next one contain information on the optional
388 components found in the contrib directory of the PostgreSQL
389 distribution. These include porting tools, analysis utilities, and
390 plug-in features that are not part of the core PostgreSQL system. They
391 are separate mainly because they address a limited audience or are too
392 experimental to be part of the main source tree. This does not preclude
395 This appendix covers extensions and other server plug-in module
396 libraries found in contrib. Appendix G covers utility programs.
398 When building from the source distribution, these optional components
399 are not built automatically, unless you build the "world" target (see
400 Step 2). You can build and install all of them by running:
404 in the contrib directory of a configured source tree; or to build and
405 install just one selected module, do the same in that module's
406 subdirectory. Many of the modules have regression tests, which can be
410 before installation or
413 once you have a PostgreSQL server running.
415 If you are using a pre-packaged version of PostgreSQL, these components
416 are typically made available as a separate subpackage, such as
419 Many components supply new user-defined functions, operators, or types,
420 packaged as extensions. To make use of one of these extensions, after
421 you have installed the code you need to register the new SQL objects in
422 the database system. This is done by executing a CREATE EXTENSION
423 command. In a fresh database, you can simply do
424 CREATE EXTENSION extension_name;
426 This command registers the new SQL objects in the current database
427 only, so you need to run it in every database in which you want the
428 extension's facilities to be available. Alternatively, run it in
429 database template1 so that the extension will be copied into
430 subsequently-created databases by default.
432 For all extensions, the CREATE EXTENSION command must be run by a
433 database superuser, unless the extension is considered “trusted”.
434 Trusted extensions can be run by any user who has CREATE privilege on
435 the current database. Extensions that are trusted are identified as
436 such in the sections that follow. Generally, trusted extensions are
437 ones that cannot provide access to outside-the-database functionality.
439 The following extensions are trusted in a default installation:
440 btree_gin fuzzystrmatch ltree tcn
441 btree_gist hstore pgcrypto tsm_system_rows
442 citext intarray pg_trgm tsm_system_time
443 cube isn seg unaccent
444 dict_int lo tablefunc uuid-ossp
446 Many extensions allow you to install their objects in a schema of your
447 choice. To do that, add SCHEMA schema_name to the CREATE EXTENSION
448 command. By default, the objects will be placed in your current
449 creation target schema, which in turn defaults to public.
451 Note, however, that some of these components are not “extensions” in
452 this sense, but are loaded into the server in some other way, for
453 instance by way of shared_preload_libraries. See the documentation of
454 each component for details.