|
85 | 85 | </thead>
|
86 | 86 | <tbody>
|
87 | 87 | <row>
|
88 |
| - <entry><literal>_abstime_ops</></entry> |
89 |
| - <entry><type>abstime[]</></entry> |
90 |
| - <entry> |
91 |
| - <literal>&&</> |
92 |
| - <literal><@</> |
93 |
| - <literal>=</> |
94 |
| - <literal>@></> |
95 |
| - </entry> |
96 |
| - </row> |
97 |
| - <row> |
98 |
| - <entry><literal>_bit_ops</></entry> |
99 |
| - <entry><type>bit[]</></entry> |
100 |
| - <entry> |
101 |
| - <literal>&&</> |
102 |
| - <literal><@</> |
103 |
| - <literal>=</> |
104 |
| - <literal>@></> |
105 |
| - </entry> |
106 |
| - </row> |
107 |
| - <row> |
108 |
| - <entry><literal>_bool_ops</></entry> |
109 |
| - <entry><type>boolean[]</></entry> |
110 |
| - <entry> |
111 |
| - <literal>&&</> |
112 |
| - <literal><@</> |
113 |
| - <literal>=</> |
114 |
| - <literal>@></> |
115 |
| - </entry> |
116 |
| - </row> |
117 |
| - <row> |
118 |
| - <entry><literal>_bpchar_ops</></entry> |
119 |
| - <entry><type>character[]</></entry> |
120 |
| - <entry> |
121 |
| - <literal>&&</> |
122 |
| - <literal><@</> |
123 |
| - <literal>=</> |
124 |
| - <literal>@></> |
125 |
| - </entry> |
126 |
| - </row> |
127 |
| - <row> |
128 |
| - <entry><literal>_bytea_ops</></entry> |
129 |
| - <entry><type>bytea[]</></entry> |
130 |
| - <entry> |
131 |
| - <literal>&&</> |
132 |
| - <literal><@</> |
133 |
| - <literal>=</> |
134 |
| - <literal>@></> |
135 |
| - </entry> |
136 |
| - </row> |
137 |
| - <row> |
138 |
| - <entry><literal>_char_ops</></entry> |
139 |
| - <entry><type>"char"[]</></entry> |
140 |
| - <entry> |
141 |
| - <literal>&&</> |
142 |
| - <literal><@</> |
143 |
| - <literal>=</> |
144 |
| - <literal>@></> |
145 |
| - </entry> |
146 |
| - </row> |
147 |
| - <row> |
148 |
| - <entry><literal>_cidr_ops</></entry> |
149 |
| - <entry><type>cidr[]</></entry> |
150 |
| - <entry> |
151 |
| - <literal>&&</> |
152 |
| - <literal><@</> |
153 |
| - <literal>=</> |
154 |
| - <literal>@></> |
155 |
| - </entry> |
156 |
| - </row> |
157 |
| - <row> |
158 |
| - <entry><literal>_date_ops</></entry> |
159 |
| - <entry><type>date[]</></entry> |
160 |
| - <entry> |
161 |
| - <literal>&&</> |
162 |
| - <literal><@</> |
163 |
| - <literal>=</> |
164 |
| - <literal>@></> |
165 |
| - </entry> |
166 |
| - </row> |
167 |
| - <row> |
168 |
| - <entry><literal>_float4_ops</></entry> |
169 |
| - <entry><type>float4[]</></entry> |
170 |
| - <entry> |
171 |
| - <literal>&&</> |
172 |
| - <literal><@</> |
173 |
| - <literal>=</> |
174 |
| - <literal>@></> |
175 |
| - </entry> |
176 |
| - </row> |
177 |
| - <row> |
178 |
| - <entry><literal>_float8_ops</></entry> |
179 |
| - <entry><type>float8[]</></entry> |
180 |
| - <entry> |
181 |
| - <literal>&&</> |
182 |
| - <literal><@</> |
183 |
| - <literal>=</> |
184 |
| - <literal>@></> |
185 |
| - </entry> |
186 |
| - </row> |
187 |
| - <row> |
188 |
| - <entry><literal>_inet_ops</></entry> |
189 |
| - <entry><type>inet[]</></entry> |
190 |
| - <entry> |
191 |
| - <literal>&&</> |
192 |
| - <literal><@</> |
193 |
| - <literal>=</> |
194 |
| - <literal>@></> |
195 |
| - </entry> |
196 |
| - </row> |
197 |
| - <row> |
198 |
| - <entry><literal>_int2_ops</></entry> |
199 |
| - <entry><type>smallint[]</></entry> |
200 |
| - <entry> |
201 |
| - <literal>&&</> |
202 |
| - <literal><@</> |
203 |
| - <literal>=</> |
204 |
| - <literal>@></> |
205 |
| - </entry> |
206 |
| - </row> |
207 |
| - <row> |
208 |
| - <entry><literal>_int4_ops</></entry> |
209 |
| - <entry><type>integer[]</></entry> |
210 |
| - <entry> |
211 |
| - <literal>&&</> |
212 |
| - <literal><@</> |
213 |
| - <literal>=</> |
214 |
| - <literal>@></> |
215 |
| - </entry> |
216 |
| - </row> |
217 |
| - <row> |
218 |
| - <entry><literal>_int8_ops</></entry> |
219 |
| - <entry><type>bigint[]</></entry> |
220 |
| - <entry> |
221 |
| - <literal>&&</> |
222 |
| - <literal><@</> |
223 |
| - <literal>=</> |
224 |
| - <literal>@></> |
225 |
| - </entry> |
226 |
| - </row> |
227 |
| - <row> |
228 |
| - <entry><literal>_interval_ops</></entry> |
229 |
| - <entry><type>interval[]</></entry> |
230 |
| - <entry> |
231 |
| - <literal>&&</> |
232 |
| - <literal><@</> |
233 |
| - <literal>=</> |
234 |
| - <literal>@></> |
235 |
| - </entry> |
236 |
| - </row> |
237 |
| - <row> |
238 |
| - <entry><literal>_macaddr_ops</></entry> |
239 |
| - <entry><type>macaddr[]</></entry> |
240 |
| - <entry> |
241 |
| - <literal>&&</> |
242 |
| - <literal><@</> |
243 |
| - <literal>=</> |
244 |
| - <literal>@></> |
245 |
| - </entry> |
246 |
| - </row> |
247 |
| - <row> |
248 |
| - <entry><literal>_money_ops</></entry> |
249 |
| - <entry><type>money[]</></entry> |
250 |
| - <entry> |
251 |
| - <literal>&&</> |
252 |
| - <literal><@</> |
253 |
| - <literal>=</> |
254 |
| - <literal>@></> |
255 |
| - </entry> |
256 |
| - </row> |
257 |
| - <row> |
258 |
| - <entry><literal>_name_ops</></entry> |
259 |
| - <entry><type>name[]</></entry> |
260 |
| - <entry> |
261 |
| - <literal>&&</> |
262 |
| - <literal><@</> |
263 |
| - <literal>=</> |
264 |
| - <literal>@></> |
265 |
| - </entry> |
266 |
| - </row> |
267 |
| - <row> |
268 |
| - <entry><literal>_numeric_ops</></entry> |
269 |
| - <entry><type>numeric[]</></entry> |
270 |
| - <entry> |
271 |
| - <literal>&&</> |
272 |
| - <literal><@</> |
273 |
| - <literal>=</> |
274 |
| - <literal>@></> |
275 |
| - </entry> |
276 |
| - </row> |
277 |
| - <row> |
278 |
| - <entry><literal>_oid_ops</></entry> |
279 |
| - <entry><type>oid[]</></entry> |
280 |
| - <entry> |
281 |
| - <literal>&&</> |
282 |
| - <literal><@</> |
283 |
| - <literal>=</> |
284 |
| - <literal>@></> |
285 |
| - </entry> |
286 |
| - </row> |
287 |
| - <row> |
288 |
| - <entry><literal>_oidvector_ops</></entry> |
289 |
| - <entry><type>oidvector[]</></entry> |
290 |
| - <entry> |
291 |
| - <literal>&&</> |
292 |
| - <literal><@</> |
293 |
| - <literal>=</> |
294 |
| - <literal>@></> |
295 |
| - </entry> |
296 |
| - </row> |
297 |
| - <row> |
298 |
| - <entry><literal>_reltime_ops</></entry> |
299 |
| - <entry><type>reltime[]</></entry> |
300 |
| - <entry> |
301 |
| - <literal>&&</> |
302 |
| - <literal><@</> |
303 |
| - <literal>=</> |
304 |
| - <literal>@></> |
305 |
| - </entry> |
306 |
| - </row> |
307 |
| - <row> |
308 |
| - <entry><literal>_text_ops</></entry> |
309 |
| - <entry><type>text[]</></entry> |
310 |
| - <entry> |
311 |
| - <literal>&&</> |
312 |
| - <literal><@</> |
313 |
| - <literal>=</> |
314 |
| - <literal>@></> |
315 |
| - </entry> |
316 |
| - </row> |
317 |
| - <row> |
318 |
| - <entry><literal>_time_ops</></entry> |
319 |
| - <entry><type>time[]</></entry> |
320 |
| - <entry> |
321 |
| - <literal>&&</> |
322 |
| - <literal><@</> |
323 |
| - <literal>=</> |
324 |
| - <literal>@></> |
325 |
| - </entry> |
326 |
| - </row> |
327 |
| - <row> |
328 |
| - <entry><literal>_timestamp_ops</></entry> |
329 |
| - <entry><type>timestamp[]</></entry> |
330 |
| - <entry> |
331 |
| - <literal>&&</> |
332 |
| - <literal><@</> |
333 |
| - <literal>=</> |
334 |
| - <literal>@></> |
335 |
| - </entry> |
336 |
| - </row> |
337 |
| - <row> |
338 |
| - <entry><literal>_timestamptz_ops</></entry> |
339 |
| - <entry><type>timestamp with time zone[]</></entry> |
340 |
| - <entry> |
341 |
| - <literal>&&</> |
342 |
| - <literal><@</> |
343 |
| - <literal>=</> |
344 |
| - <literal>@></> |
345 |
| - </entry> |
346 |
| - </row> |
347 |
| - <row> |
348 |
| - <entry><literal>_timetz_ops</></entry> |
349 |
| - <entry><type>time with time zone[]</></entry> |
350 |
| - <entry> |
351 |
| - <literal>&&</> |
352 |
| - <literal><@</> |
353 |
| - <literal>=</> |
354 |
| - <literal>@></> |
355 |
| - </entry> |
356 |
| - </row> |
357 |
| - <row> |
358 |
| - <entry><literal>_tinterval_ops</></entry> |
359 |
| - <entry><type>tinterval[]</></entry> |
360 |
| - <entry> |
361 |
| - <literal>&&</> |
362 |
| - <literal><@</> |
363 |
| - <literal>=</> |
364 |
| - <literal>@></> |
365 |
| - </entry> |
366 |
| - </row> |
367 |
| - <row> |
368 |
| - <entry><literal>_varbit_ops</></entry> |
369 |
| - <entry><type>bit varying[]</></entry> |
370 |
| - <entry> |
371 |
| - <literal>&&</> |
372 |
| - <literal><@</> |
373 |
| - <literal>=</> |
374 |
| - <literal>@></> |
375 |
| - </entry> |
376 |
| - </row> |
377 |
| - <row> |
378 |
| - <entry><literal>_varchar_ops</></entry> |
379 |
| - <entry><type>character varying[]</></entry> |
| 88 | + <entry><literal>array_ops</></entry> |
| 89 | + <entry><type>anyarray</></entry> |
380 | 90 | <entry>
|
381 | 91 | <literal>&&</>
|
382 | 92 | <literal><@</>
|
|
441 | 151 | </para>
|
442 | 152 |
|
443 | 153 | <para>
|
444 |
| - There are three methods that an operator class for |
| 154 | + There are two methods that an operator class for |
445 | 155 | <acronym>GIN</acronym> must provide:
|
446 | 156 |
|
447 |
| - <variablelist> |
448 |
| - <varlistentry> |
449 |
| - <term><function>int compare(Datum a, Datum b)</></term> |
450 |
| - <listitem> |
451 |
| - <para> |
452 |
| - Compares two keys (not indexed items!) and returns an integer less than |
453 |
| - zero, zero, or greater than zero, indicating whether the first key is |
454 |
| - less than, equal to, or greater than the second. Null keys are never |
455 |
| - passed to this function. |
456 |
| - </para> |
457 |
| - </listitem> |
458 |
| - </varlistentry> |
459 |
| - |
| 157 | + <variablelist> |
460 | 158 | <varlistentry>
|
461 | 159 | <term><function>Datum *extractValue(Datum itemValue, int32 *nkeys,
|
462 | 160 | bool **nullFlags)</></term>
|
|
645 | 343 | </listitem>
|
646 | 344 | </varlistentry>
|
647 | 345 | </variablelist>
|
| 346 | + </para> |
| 347 | + |
| 348 | + <para> |
| 349 | + In addition, GIN must have a way to sort the key values stored in the index. |
| 350 | + The operator class can define the sort ordering by specifying a comparison |
| 351 | + method: |
648 | 352 |
|
| 353 | + <variablelist> |
| 354 | + <varlistentry> |
| 355 | + <term><function>int compare(Datum a, Datum b)</></term> |
| 356 | + <listitem> |
| 357 | + <para> |
| 358 | + Compares two keys (not indexed items!) and returns an integer less than |
| 359 | + zero, zero, or greater than zero, indicating whether the first key is |
| 360 | + less than, equal to, or greater than the second. Null keys are never |
| 361 | + passed to this function. |
| 362 | + </para> |
| 363 | + </listitem> |
| 364 | + </varlistentry> |
| 365 | + </variablelist> |
| 366 | + |
| 367 | + Alternatively, if the operator class does not provide a <function>compare</> |
| 368 | + method, GIN will look up the default btree operator class for the index |
| 369 | + key data type, and use its comparison function. It is recommended to |
| 370 | + specify the comparison function in a GIN operator class that is meant for |
| 371 | + just one data type, as looking up the btree operator class costs a few |
| 372 | + cycles. However, polymorphic GIN operator classes (such |
| 373 | + as <literal>array_ops</>) typically cannot specify a single comparison |
| 374 | + function. |
| 375 | + </para> |
| 376 | + |
| 377 | + <para> |
649 | 378 | Optionally, an operator class for <acronym>GIN</acronym> can supply the
|
650 | 379 | following method:
|
651 | 380 |
|
|
900 | 629 | <title>Examples</title>
|
901 | 630 |
|
902 | 631 | <para>
|
903 |
| - The <productname>PostgreSQL</productname> source distribution includes |
904 |
| - <acronym>GIN</acronym> operator classes for <type>tsvector</> and |
905 |
| - for one-dimensional arrays of all internal types. Prefix searching in |
906 |
| - <type>tsvector</> is implemented using the <acronym>GIN</> partial match |
907 |
| - feature. |
| 632 | + The core <productname>PostgreSQL</> distribution |
| 633 | + includes the <acronym>GIN</acronym> operator classes previously shown in |
| 634 | + <xref linkend="gin-builtin-opclasses-table">. |
908 | 635 | The following <filename>contrib</> modules also contain
|
909 | 636 | <acronym>GIN</acronym> operator classes:
|
910 | 637 |
|
|
0 commit comments