1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!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>52.4. pg_amop</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="catalog-pg-am.html" title="52.3. pg_am" /><link rel="next" href="catalog-pg-amproc.html" title="52.5. pg_amproc" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">52.4. <code class="structname">pg_amop</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-am.html" title="52.3. pg_am">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 52. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 52. System Catalogs</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="catalog-pg-amproc.html" title="52.5. pg_amproc">Next</a></td></tr></table><hr /></div><div class="sect1" id="CATALOG-PG-AMOP"><div class="titlepage"><div><div><h2 class="title" style="clear: both">52.4. <code class="structname">pg_amop</code> <a href="#CATALOG-PG-AMOP" class="id_link">#</a></h2></div></div></div><a id="id-1.10.4.6.2" class="indexterm"></a><p>
3 The catalog <code class="structname">pg_amop</code> stores information about
4 operators associated with access method operator families. There is one
5 row for each operator that is a member of an operator family. A family
6 member can be either a <em class="firstterm">search</em> operator or an
7 <em class="firstterm">ordering</em> operator. An operator
8 can appear in more than one family, but cannot appear in more than one
9 search position nor more than one ordering position within a family.
10 (It is allowed, though unlikely, for an operator to be used for both
11 search and ordering purposes.)
12 </p><div class="table" id="id-1.10.4.6.4"><p class="title"><strong>Table 52.4. <code class="structname">pg_amop</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_amop Columns" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
17 </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
18 <code class="structfield">oid</code> <code class="type">oid</code>
22 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
23 <code class="structfield">amopfamily</code> <code class="type">oid</code>
24 (references <a class="link" href="catalog-pg-opfamily.html" title="52.35. pg_opfamily"><code class="structname">pg_opfamily</code></a>.<code class="structfield">oid</code>)
27 The operator family this entry is for
28 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
29 <code class="structfield">amoplefttype</code> <code class="type">oid</code>
30 (references <a class="link" href="catalog-pg-type.html" title="52.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
33 Left-hand input data type of operator
34 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
35 <code class="structfield">amoprighttype</code> <code class="type">oid</code>
36 (references <a class="link" href="catalog-pg-type.html" title="52.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
39 Right-hand input data type of operator
40 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
41 <code class="structfield">amopstrategy</code> <code class="type">int2</code>
44 Operator strategy number
45 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
46 <code class="structfield">amoppurpose</code> <code class="type">char</code>
49 Operator purpose, either <code class="literal">s</code> for search or
50 <code class="literal">o</code> for ordering
51 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
52 <code class="structfield">amopopr</code> <code class="type">oid</code>
53 (references <a class="link" href="catalog-pg-operator.html" title="52.34. pg_operator"><code class="structname">pg_operator</code></a>.<code class="structfield">oid</code>)
57 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
58 <code class="structfield">amopmethod</code> <code class="type">oid</code>
59 (references <a class="link" href="catalog-pg-am.html" title="52.3. pg_am"><code class="structname">pg_am</code></a>.<code class="structfield">oid</code>)
62 Index access method operator family is for
63 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
64 <code class="structfield">amopsortfamily</code> <code class="type">oid</code>
65 (references <a class="link" href="catalog-pg-opfamily.html" title="52.35. pg_opfamily"><code class="structname">pg_opfamily</code></a>.<code class="structfield">oid</code>)
68 The B-tree operator family this entry sorts according to, if an
69 ordering operator; zero if a search operator
70 </p></td></tr></tbody></table></div></div><br class="table-break" /><p>
71 A <span class="quote">“<span class="quote">search</span>”</span> operator entry indicates that an index of this operator
72 family can be searched to find all rows satisfying
73 <code class="literal">WHERE</code>
74 <em class="replaceable"><code>indexed_column</code></em>
75 <em class="replaceable"><code>operator</code></em>
76 <em class="replaceable"><code>constant</code></em>.
77 Obviously, such an operator must return <code class="type">boolean</code>, and its left-hand input
78 type must match the index's column data type.
80 An <span class="quote">“<span class="quote">ordering</span>”</span> operator entry indicates that an index of this
81 operator family can be scanned to return rows in the order represented by
82 <code class="literal">ORDER BY</code>
83 <em class="replaceable"><code>indexed_column</code></em>
84 <em class="replaceable"><code>operator</code></em>
85 <em class="replaceable"><code>constant</code></em>.
86 Such an operator could return any sortable data type, though again
87 its left-hand input type must match the index's column data type.
88 The exact semantics of the <code class="literal">ORDER BY</code> are specified by the
89 <code class="structfield">amopsortfamily</code> column, which must reference
90 a B-tree operator family for the operator's result type.
91 </p><div class="note"><h3 class="title">Note</h3><p>
92 At present, it's assumed that the sort order for an ordering operator
93 is the default for the referenced operator family, i.e., <code class="literal">ASC NULLS
94 LAST</code>. This might someday be relaxed by adding additional columns
95 to specify sort options explicitly.
97 An entry's <code class="structfield">amopmethod</code> must match the
98 <code class="structfield">opfmethod</code> of its containing operator family (including
99 <code class="structfield">amopmethod</code> here is an intentional denormalization of the
100 catalog structure for performance reasons). Also,
101 <code class="structfield">amoplefttype</code> and <code class="structfield">amoprighttype</code> must match
102 the <code class="structfield">oprleft</code> and <code class="structfield">oprright</code> fields of the
103 referenced <a class="link" href="catalog-pg-operator.html" title="52.34. pg_operator"><code class="structname">pg_operator</code></a> entry.
104 </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-am.html" title="52.3. pg_am">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html" title="Chapter 52. System Catalogs">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-amproc.html" title="52.5. pg_amproc">Next</a></td></tr><tr><td width="40%" align="left" valign="top">52.3. <code class="structname">pg_am</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 52.5. <code class="structname">pg_amproc</code></td></tr></table></div></body></html>