| Server IP : 172.67.134.114 / Your IP : 162.159.115.42 Web Server : Apache/2.4.37 System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64 User : ricodeal ( 1046) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/postgresql-docs/html/ |
Upload File : |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 37. Extending SQL</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="[email protected]" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="server-programming.html" title="Part V. Server Programming" /><link rel="next" href="extend-how.html" title="37.1. How Extensibility Works" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">Chapter 37. Extending <acronym xmlns="http://www.w3.org/1999/xhtml" class="acronym">SQL</acronym></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="server-programming.html" title="Part V. Server Programming">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="server-programming.html" title="Part V. Server Programming">Up</a></td><th width="60%" align="center">Part V. Server Programming</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 10.23 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="extend-how.html" title="37.1. How Extensibility Works">Next</a></td></tr></table><hr></hr></div><div class="chapter" id="EXTEND"><div class="titlepage"><div><div><h2 class="title">Chapter 37. Extending <acronym class="acronym">SQL</acronym></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="extend-how.html">37.1. How Extensibility Works</a></span></dt><dt><span class="sect1"><a href="extend-type-system.html">37.2. The <span class="productname">PostgreSQL</span> Type System</a></span></dt><dd><dl><dt><span class="sect2"><a href="extend-type-system.html#id-1.8.3.5.7">37.2.1. Base Types</a></span></dt><dt><span class="sect2"><a href="extend-type-system.html#id-1.8.3.5.8">37.2.2. Composite Types</a></span></dt><dt><span class="sect2"><a href="extend-type-system.html#EXTEND-TYPE-SYSTEM-DOMAINS">37.2.3. Domains</a></span></dt><dt><span class="sect2"><a href="extend-type-system.html#id-1.8.3.5.10">37.2.4. Pseudo-Types</a></span></dt><dt><span class="sect2"><a href="extend-type-system.html#EXTEND-TYPES-POLYMORPHIC">37.2.5. Polymorphic Types</a></span></dt></dl></dd><dt><span class="sect1"><a href="xfunc.html">37.3. User-defined Functions</a></span></dt><dt><span class="sect1"><a href="xfunc-sql.html">37.4. Query Language (<acronym class="acronym">SQL</acronym>) Functions</a></span></dt><dd><dl><dt><span class="sect2"><a href="xfunc-sql.html#XFUNC-SQL-FUNCTION-ARGUMENTS">37.4.1. Arguments for <acronym class="acronym">SQL</acronym> Functions</a></span></dt><dt><span class="sect2"><a href="xfunc-sql.html#XFUNC-SQL-BASE-FUNCTIONS">37.4.2. <acronym class="acronym">SQL</acronym> Functions on Base Types</a></span></dt><dt><span class="sect2"><a href="xfunc-sql.html#XFUNC-SQL-COMPOSITE-FUNCTIONS">37.4.3. <acronym class="acronym">SQL</acronym> Functions on Composite Types</a></span></dt><dt><span class="sect2"><a href="xfunc-sql.html#XFUNC-OUTPUT-PARAMETERS">37.4.4. <acronym class="acronym">SQL</acronym> Functions with Output Parameters</a></span></dt><dt><span class="sect2"><a href="xfunc-sql.html#XFUNC-SQL-VARIADIC-FUNCTIONS">37.4.5. <acronym class="acronym">SQL</acronym> Functions with Variable Numbers of Arguments</a></span></dt><dt><span class="sect2"><a href="xfunc-sql.html#XFUNC-SQL-PARAMETER-DEFAULTS">37.4.6. <acronym class="acronym">SQL</acronym> Functions with Default Values for Arguments</a></span></dt><dt><span class="sect2"><a href="xfunc-sql.html#XFUNC-SQL-TABLE-FUNCTIONS">37.4.7. <acronym class="acronym">SQL</acronym> Functions as Table Sources</a></span></dt><dt><span class="sect2"><a href="xfunc-sql.html#XFUNC-SQL-FUNCTIONS-RETURNING-SET">37.4.8. <acronym class="acronym">SQL</acronym> Functions Returning Sets</a></span></dt><dt><span class="sect2"><a href="xfunc-sql.html#XFUNC-SQL-FUNCTIONS-RETURNING-TABLE">37.4.9. <acronym class="acronym">SQL</acronym> Functions Returning <code class="literal">TABLE</code></a></span></dt><dt><span class="sect2"><a href="xfunc-sql.html#id-1.8.3.7.18">37.4.10. Polymorphic <acronym class="acronym">SQL</acronym> Functions</a></span></dt><dt><span class="sect2"><a href="xfunc-sql.html#id-1.8.3.7.19">37.4.11. <acronym class="acronym">SQL</acronym> Functions with Collations</a></span></dt></dl></dd><dt><span class="sect1"><a href="xfunc-overload.html">37.5. Function Overloading</a></span></dt><dt><span class="sect1"><a href="xfunc-volatility.html">37.6. Function Volatility Categories</a></span></dt><dt><span class="sect1"><a href="xfunc-pl.html">37.7. Procedural Language Functions</a></span></dt><dt><span class="sect1"><a href="xfunc-internal.html">37.8. Internal Functions</a></span></dt><dt><span class="sect1"><a href="xfunc-c.html">37.9. C-Language Functions</a></span></dt><dd><dl><dt><span class="sect2"><a href="xfunc-c.html#XFUNC-C-DYNLOAD">37.9.1. Dynamic Loading</a></span></dt><dt><span class="sect2"><a href="xfunc-c.html#XFUNC-C-BASETYPE">37.9.2. Base Types in C-Language Functions</a></span></dt><dt><span class="sect2"><a href="xfunc-c.html#id-1.8.3.12.7">37.9.3. Version 1 Calling Conventions</a></span></dt><dt><span class="sect2"><a href="xfunc-c.html#id-1.8.3.12.8">37.9.4. Writing Code</a></span></dt><dt><span class="sect2"><a href="xfunc-c.html#DFUNC">37.9.5. Compiling and Linking Dynamically-loaded Functions</a></span></dt><dt><span class="sect2"><a href="xfunc-c.html#id-1.8.3.12.10">37.9.6. Composite-type Arguments</a></span></dt><dt><span class="sect2"><a href="xfunc-c.html#id-1.8.3.12.11">37.9.7. Returning Rows (Composite Types)</a></span></dt><dt><span class="sect2"><a href="xfunc-c.html#XFUNC-C-RETURN-SET">37.9.8. Returning Sets</a></span></dt><dt><span class="sect2"><a href="xfunc-c.html#id-1.8.3.12.13">37.9.9. Polymorphic Arguments and Return Types</a></span></dt><dt><span class="sect2"><a href="xfunc-c.html#XFUNC-TRANSFORM-FUNCTIONS">37.9.10. Transform Functions</a></span></dt><dt><span class="sect2"><a href="xfunc-c.html#id-1.8.3.12.15">37.9.11. Shared Memory and LWLocks</a></span></dt><dt><span class="sect2"><a href="xfunc-c.html#EXTEND-CPP">37.9.12. Using C++ for Extensibility</a></span></dt></dl></dd><dt><span class="sect1"><a href="xaggr.html">37.10. User-defined Aggregates</a></span></dt><dd><dl><dt><span class="sect2"><a href="xaggr.html#XAGGR-MOVING-AGGREGATES">37.10.1. Moving-Aggregate Mode</a></span></dt><dt><span class="sect2"><a href="xaggr.html#XAGGR-POLYMORPHIC-AGGREGATES">37.10.2. Polymorphic and Variadic Aggregates</a></span></dt><dt><span class="sect2"><a href="xaggr.html#XAGGR-ORDERED-SET-AGGREGATES">37.10.3. Ordered-Set Aggregates</a></span></dt><dt><span class="sect2"><a href="xaggr.html#XAGGR-PARTIAL-AGGREGATES">37.10.4. Partial Aggregation</a></span></dt><dt><span class="sect2"><a href="xaggr.html#XAGGR-SUPPORT-FUNCTIONS">37.10.5. Support Functions for Aggregates</a></span></dt></dl></dd><dt><span class="sect1"><a href="xtypes.html">37.11. User-defined Types</a></span></dt><dd><dl><dt><span class="sect2"><a href="xtypes.html#XTYPES-TOAST">37.11.1. TOAST Considerations</a></span></dt></dl></dd><dt><span class="sect1"><a href="xoper.html">37.12. User-defined Operators</a></span></dt><dt><span class="sect1"><a href="xoper-optimization.html">37.13. Operator Optimization Information</a></span></dt><dd><dl><dt><span class="sect2"><a href="xoper-optimization.html#id-1.8.3.16.4">37.13.1. <code class="literal">COMMUTATOR</code></a></span></dt><dt><span class="sect2"><a href="xoper-optimization.html#id-1.8.3.16.5">37.13.2. <code class="literal">NEGATOR</code></a></span></dt><dt><span class="sect2"><a href="xoper-optimization.html#id-1.8.3.16.6">37.13.3. <code class="literal">RESTRICT</code></a></span></dt><dt><span class="sect2"><a href="xoper-optimization.html#id-1.8.3.16.7">37.13.4. <code class="literal">JOIN</code></a></span></dt><dt><span class="sect2"><a href="xoper-optimization.html#id-1.8.3.16.8">37.13.5. <code class="literal">HASHES</code></a></span></dt><dt><span class="sect2"><a href="xoper-optimization.html#id-1.8.3.16.9">37.13.6. <code class="literal">MERGES</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="xindex.html">37.14. Interfacing Extensions To Indexes</a></span></dt><dd><dl><dt><span class="sect2"><a href="xindex.html#XINDEX-OPCLASS">37.14.1. Index Methods and Operator Classes</a></span></dt><dt><span class="sect2"><a href="xindex.html#XINDEX-STRATEGIES">37.14.2. Index Method Strategies</a></span></dt><dt><span class="sect2"><a href="xindex.html#XINDEX-SUPPORT">37.14.3. Index Method Support Routines</a></span></dt><dt><span class="sect2"><a href="xindex.html#XINDEX-EXAMPLE">37.14.4. An Example</a></span></dt><dt><span class="sect2"><a href="xindex.html#XINDEX-OPFAMILY">37.14.5. Operator Classes and Operator Families</a></span></dt><dt><span class="sect2"><a href="xindex.html#XINDEX-OPCLASS-DEPENDENCIES">37.14.6. System Dependencies on Operator Classes</a></span></dt><dt><span class="sect2"><a href="xindex.html#XINDEX-ORDERING-OPS">37.14.7. Ordering Operators</a></span></dt><dt><span class="sect2"><a href="xindex.html#XINDEX-OPCLASS-FEATURES">37.14.8. Special Features of Operator Classes</a></span></dt></dl></dd><dt><span class="sect1"><a href="extend-extensions.html">37.15. Packaging Related Objects into an Extension</a></span></dt><dd><dl><dt><span class="sect2"><a href="extend-extensions.html#id-1.8.3.18.11">37.15.1. Extension Files</a></span></dt><dt><span class="sect2"><a href="extend-extensions.html#EXTEND-EXTENSIONS-RELOCATION">37.15.2. Extension Relocatability</a></span></dt><dt><span class="sect2"><a href="extend-extensions.html#EXTEND-EXTENSIONS-CONFIG-TABLES">37.15.3. Extension Configuration Tables</a></span></dt><dt><span class="sect2"><a href="extend-extensions.html#id-1.8.3.18.14">37.15.4. Extension Updates</a></span></dt><dt><span class="sect2"><a href="extend-extensions.html#id-1.8.3.18.15">37.15.5. Installing Extensions using Update Scripts</a></span></dt><dt><span class="sect2"><a href="extend-extensions.html#EXTEND-EXTENSIONS-SECURITY">37.15.6. Security Considerations for Extensions</a></span></dt><dt><span class="sect2"><a href="extend-extensions.html#EXTEND-EXTENSIONS-EXAMPLE">37.15.7. Extension Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="extend-pgxs.html">37.16. Extension Building Infrastructure</a></span></dt></dl></div><a id="id-1.8.3.2" class="indexterm"></a><p> In the sections that follow, we will discuss how you
can extend the <span class="productname">PostgreSQL</span>
<acronym class="acronym">SQL</acronym> query language by adding:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: bullet; "><li class="listitem" style="list-style-type: disc"><p> functions (starting in <a class="xref" href="xfunc.html" title="37.3. User-defined Functions">Section 37.3</a>)
</p></li><li class="listitem" style="list-style-type: disc"><p> aggregates (starting in <a class="xref" href="xaggr.html" title="37.10. User-defined Aggregates">Section 37.10</a>)
</p></li><li class="listitem" style="list-style-type: disc"><p> data types (starting in <a class="xref" href="xtypes.html" title="37.11. User-defined Types">Section 37.11</a>)
</p></li><li class="listitem" style="list-style-type: disc"><p> operators (starting in <a class="xref" href="xoper.html" title="37.12. User-defined Operators">Section 37.12</a>)
</p></li><li class="listitem" style="list-style-type: disc"><p> operator classes for indexes (starting in <a class="xref" href="xindex.html" title="37.14. Interfacing Extensions To Indexes">Section 37.14</a>)
</p></li><li class="listitem" style="list-style-type: disc"><p> packages of related objects (starting in <a class="xref" href="extend-extensions.html" title="37.15. Packaging Related Objects into an Extension">Section 37.15</a>)
</p></li></ul></div><p>
</p></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="server-programming.html" title="Part V. Server Programming">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="server-programming.html" title="Part V. Server Programming">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="extend-how.html" title="37.1. How Extensibility Works">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part V. Server Programming </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 10.23 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 37.1. How Extensibility Works</td></tr></table></div></body></html>