oper.sgml 17.7 KB
Newer Older
1 2
 <Chapter Id="operators">
  <Title id="operators-title">Operators</Title>
3

4 5 6 7 8 9
  <Abstract>
   <Para>
    Describes the built-in operators available in 
    <ProductName>Postgres</ProductName>.
   </Para>
  </Abstract>
10

11 12 13 14
  <Para>
   <ProductName>Postgres</ProductName> provides a large number of 
   built-in operators on system types.
   These operators are declared in the system catalog
15
   <literal>pg_operator</literal>.  Every entry in <literal>pg_operator</literal> includes
16 17 18
   the name of the procedure that implements the operator and the
   class <Acronym>OIDs</Acronym> of the input and output types.
  </Para>
19

20 21 22 23
  <Para>
   To view all variations of the <Quote>||</Quote> string concatenation operator, 
   try
   <ProgramListing>
24 25 26 27 28 29 30 31 32
    SELECT oprleft, oprright, oprresult, oprcode
    FROM pg_operator WHERE oprname = '||';

oprleft|oprright|oprresult|oprcode
-------+--------+---------+-------
     25|      25|       25|textcat
   1042|    1042|     1042|textcat
   1043|    1043|     1043|textcat
(3 rows)
33 34
   </ProgramListing>
  </Para>
35

36 37
  <Para>
   Users may invoke operators using the operator name, as in:
38

39
   <ProgramListing>
40
select * from emp where salary < 40000;
41
   </ProgramListing>
42

43 44 45 46
   Alternatively, users may call the functions that implement the
   operators directly.  In this case, the query above would be expressed
   as:
   <ProgramListing>
47
select * from emp where int4lt(salary, 40000);
48 49
   </ProgramListing>
  </Para>
50

51 52 53 54
  <Para>
   <Application>psql</Application>
   has a command (<Command>\dd</Command>) to show these operators.
  </Para>
55

56 57
  <sect1>
   <title>Lexical Precedence</title>
58

59 60 61 62 63
   <para>
    Operators have a precedence which is currently hardcoded into the parser.
    Most operators have the same precedence and are left-associative. This may lead
    to non-intuitive behavior; for example the boolean operators "&lt;" and "&gt;"
    have a different precedence that the boolean operators "&lt;=" and "&gt;=".
64 65 66 67 68 69 70 71 72 73 74

<table tocentry="1">
<title>
Operator Ordering (decreasing precedence)
</title>

<tgroup cols="2">
<thead>
<row>
<entry>
Element
75
</entry>
76 77
<entry>
Precedence
78
</entry>
79 80
<entry>
Description
81 82
</entry>
</row>
83 84 85 86 87 88
</thead>

<tbody>
<row>
<entry>
UNION
89
</entry>
90 91
<entry>
left
92
</entry>
93 94
<entry>
SQL select construct
95 96
</entry>
</row>
97 98 99
<row>
<entry>
::
100
</entry>
101
<entry>
102
</entry>
103 104
<entry>
<productname>Postgres</productname> typecasting
105 106
</entry>
</row>
107 108 109
<row>
<entry>
[ ]
110
</entry>
111 112
<entry>
left
113
</entry>
114 115
<entry>
array delimiters
116 117
</entry>
</row>
118 119 120
<row>
<entry>
.
121
</entry>
122 123
<entry>
left
124
</entry>
125 126
<entry>
table/column delimiter
127 128
</entry>
</row>
129 130 131
<row>
<entry>
-
132
</entry>
133 134
<entry>
right
135
</entry>
136 137
<entry>
unary minus
138 139
</entry>
</row>
140 141 142
<row>
<entry>
;
143
</entry>
144 145
<entry>
left
146
</entry>
147 148
<entry>
statement termination, logarithm
149 150
</entry>
</row>
151 152 153
<row>
<entry>
:
154
</entry>
155 156
<entry>
right
157
</entry>
158 159
<entry>
exponentiation
160 161
</entry>
</row>
162 163 164
<row>
<entry>
|
165
</entry>
166 167
<entry>
left
168
</entry>
169 170
<entry>
start of interval
171 172
</entry>
</row>
173 174
<row>
<entry>
175
* / %
176
</entry>
177 178
<entry>
left
179
</entry>
180 181
<entry>
multiplication, division
182 183
</entry>
</row>
184 185 186
<row>
<entry>
+ -
187
</entry>
188 189
<entry>
left
190
</entry>
191 192
<entry>
addition, subtraction
193 194
</entry>
</row>
195 196 197
<row>
<entry>
IS
198
</entry>
199
<entry>
200
</entry>
201 202
<entry>
test for TRUE, FALSE, NULL
203 204
</entry>
</row>
205 206 207
<row>
<entry>
ISNULL
208
</entry>
209
<entry>
210
</entry>
211 212
<entry>
test for NULL
213 214
</entry>
</row>
215 216 217
<row>
<entry>
NOTNULL
218
</entry>
219
<entry>
220
</entry>
221 222
<entry>
test for NOT NULL
223 224
</entry>
</row>
225 226 227
<row>
<entry>
(all other operators)
228
</entry>
229
<entry>
230
</entry>
231 232
<entry>
native and user-defined
233 234
</entry>
</row>
235 236 237
<row>
<entry>
IN
238
</entry>
239
<entry>
240
</entry>
241 242
<entry>
set membership
243 244
</entry>
</row>
245 246 247
<row>
<entry>
BETWEEN
248
</entry>
249
<entry>
250
</entry>
251 252
<entry>
containment
253 254
</entry>
</row>
255 256 257
<row>
<entry>
LIKE
258
</entry>
259
<entry>
260
</entry>
261 262
<entry>
string pattern matching
263 264
</entry>
</row>
265 266 267
<row>
<entry>
&lt; &gt;
268
</entry>
269
<entry>
270
</entry>
271 272
<entry>
boolean inequality
273 274
</entry>
</row>
275 276 277
<row>
<entry>
=
278
</entry>
279 280
<entry>
right
281
</entry>
282 283
<entry>
equality
284 285
</entry>
</row>
286 287 288
<row>
<entry>
NOT
289
</entry>
290 291
<entry>
right
292
</entry>
293 294
<entry>
negation
295 296
</entry>
</row>
297 298 299
<row>
<entry>
AND
300
</entry>
301 302
<entry>
left
303
</entry>
304 305
<entry>
logical intersection
306 307
</entry>
</row>
308 309 310
<row>
<entry>
OR
311
</entry>
312 313
<entry>
left
314
</entry>
315 316
<entry>
logical union
317 318
</entry>
</row>
319
</tbody>
320
</tgroup>
321
</table>
322 323
</para>
</sect1>
324

325 326
  <sect1>
   <title>General Operators</title>
327

328 329 330 331
   <para>
    The operators listed here are defined for a number of native data types, 
    ranging from numeric types to data/time types.
   </para>
332

333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413
   <Para>
    <TABLE TOCENTRY="1">
     <TITLE><ProductName>Postgres</ProductName> Operators</TITLE>
     <TITLEABBREV>Operators</TITLEABBREV>
     <TGROUP COLS="3">
      <THEAD>
       <ROW>
	<ENTRY>Operator</ENTRY>
	<ENTRY>Description</ENTRY>
	<ENTRY>Usage</ENTRY>
       </ROW>
      </THEAD>
      <TBODY>
       <ROW>
	<ENTRY> &lt; </ENTRY>
	<ENTRY>Less than?</ENTRY>
	<ENTRY>1 &lt; 2</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;= </ENTRY>
	<ENTRY>Less than or equal to?</ENTRY>
	<ENTRY>1 &lt;= 2</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;&gt; </ENTRY>
	<ENTRY>Not equal?</ENTRY>
	<ENTRY>1 &lt;&gt; 2</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> = </ENTRY>
	<ENTRY>Equal?</ENTRY>
	<ENTRY>1 = 1</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt; </ENTRY>
	<ENTRY>Greater than?</ENTRY>
	<ENTRY>2 &gt; 1</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt;= </ENTRY>
	<ENTRY>Greater than or equal to?</ENTRY>
	<ENTRY>2 &gt;= 1</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> || </ENTRY>
	<ENTRY>Concatenate strings</ENTRY>
	<ENTRY>'Postgre' || 'SQL'</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> !!= </ENTRY>
	<ENTRY>NOT IN</ENTRY>
	<ENTRY>3 !!= i</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ~~ </ENTRY>
	<ENTRY>LIKE</ENTRY>
	<ENTRY>'scrappy,marc,hermit' ~~ '%scrappy%'</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> !~~ </ENTRY>
	<ENTRY>NOT LIKE</ENTRY>
	<ENTRY>'bruce' !~~ '%al%'</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ~ </ENTRY>
	<ENTRY>Match (regex), case sensitive</ENTRY>
	<ENTRY>'thomas' ~ '.*thomas.*'</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ~* </ENTRY>
	<ENTRY>Match (regex), case insensitive</ENTRY>
	<ENTRY>'thomas' ~* '.*Thomas.*'</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> !~ </ENTRY>
	<ENTRY>Does not match (regex), case sensitive</ENTRY>
	<ENTRY>'thomas' !~ '.*Thomas.*'</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> !~* </ENTRY>
	<ENTRY>Does not match (regex), case insensitive</ENTRY>
414
	<ENTRY>'thomas' !~* '.*vadim.*'</ENTRY>
415 416 417 418 419 420
       </ROW>
      </TBODY>
     </TGROUP>
    </TABLE>
   </Para>
  </sect1>
421

422 423
  <sect1>
   <title id="math-opers">Numerical Operators</title>
424

425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
   <Para>
    <TABLE TOCENTRY="1">
     <TITLE><ProductName>Postgres</ProductName> Numerical Operators</TITLE>
     <TITLEABBREV>Operators</TITLEABBREV>
     <TGROUP COLS="3">
      <THEAD>
       <ROW>
	<ENTRY>Operator</ENTRY>
	<ENTRY>Description</ENTRY>
	<ENTRY>Usage</ENTRY>
       </ROW>
      </THEAD>
      <TBODY>
       <ROW>
	<ENTRY> !  </ENTRY>
	<ENTRY>Factorial</ENTRY>
	<ENTRY>3 !</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> !!  </ENTRY>
	<ENTRY>Factorial (left operator)</ENTRY>
	<ENTRY>!! 3</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> % </ENTRY>
	<ENTRY>Modulo</ENTRY>
	<ENTRY>5 % 4</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> % </ENTRY>
	<ENTRY>Truncate</ENTRY>
	<ENTRY>% 4.5</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> * </ENTRY>
	<ENTRY>Multiplication</ENTRY>
	<ENTRY>2 * 3</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> + </ENTRY>
	<ENTRY>Addition</ENTRY>
	<ENTRY>2 + 3</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> - </ENTRY>
	<ENTRY>Subtraction</ENTRY>
	<ENTRY>2 - 3</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> / </ENTRY>
	<ENTRY>Division</ENTRY>
	<ENTRY>4 / 2</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> : </ENTRY>
	<ENTRY>Natural Exponentiation</ENTRY>
	<ENTRY>: 3.0</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ; </ENTRY>
	<ENTRY>Natural Logarithm</ENTRY>
	<ENTRY>(; 5.0)</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> @ </ENTRY>
	<ENTRY>Absolute value</ENTRY>
	<ENTRY>@ -5.0</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ^ </ENTRY>
	<ENTRY>Exponentiation</ENTRY>
	<ENTRY>2.0 ^ 3.0</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> |/ </ENTRY>
	<ENTRY>Square root</ENTRY>
	<ENTRY>|/ 25.0</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ||/ </ENTRY>
	<ENTRY>Cube root</ENTRY>
	<ENTRY>||/ 27.0</ENTRY>
       </ROW>
      </TBODY>
     </TGROUP>
    </TABLE>
   </Para>
  </sect1>
513

514 515
  <sect1>
   <title>Geometric Operators</title>
516

517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735
   <Para>
    <TABLE TOCENTRY="1">
     <TITLE><ProductName>Postgres</ProductName> Geometric Operators</TITLE>
     <TITLEABBREV>Operators</TITLEABBREV>
     <TGROUP COLS="3">
      <THEAD>
       <ROW>
	<ENTRY>Operator</ENTRY>
	<ENTRY>Description</ENTRY>
	<ENTRY>Usage</ENTRY>
       </ROW>
      </THEAD>
      <TBODY>
       <ROW>
	<ENTRY> + </ENTRY>
	<ENTRY>Translation</ENTRY>
	<ENTRY>'((0,0),(1,1))'::box + '(2.0,0)'::point</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> - </ENTRY>
	<ENTRY>Translation</ENTRY>
	<ENTRY>'((0,0),(1,1))'::box - '(2.0,0)'::point</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> * </ENTRY>
	<ENTRY>Scaling/rotation</ENTRY>
	<ENTRY>'((0,0),(1,1))'::box * '(2.0,0)'::point</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> / </ENTRY>
	<ENTRY>Scaling/rotation</ENTRY>
	<ENTRY>'((0,0),(2,2))'::box / '(2.0,0)'::point</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> # </ENTRY>
	<ENTRY>Intersection</ENTRY>
	<ENTRY>'((1,-1),(-1,1))' # '((1,1),(-1,-1))'</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> # </ENTRY>
	<ENTRY>Number of points in polygon</ENTRY>
	<ENTRY># '((1,0),(0,1),(-1,0))'</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ## </ENTRY>
	<ENTRY>Point of closest proximity</ENTRY>
	<ENTRY>'(0,0)'::point ## '((2,0),(0,2))'::lseg</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &amp;&amp; </ENTRY>
	<ENTRY>Overlaps?</ENTRY>
	<ENTRY>'((0,0),(1,1))'::box &amp;&amp; '((0,0),(2,2))'::box</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &amp;&lt; </ENTRY>
	<ENTRY>Overlaps to left?</ENTRY>
	<ENTRY>'((0,0),(1,1))'::box &amp;&lt; '((0,0),(2,2))'::box</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &amp;&gt; </ENTRY>
	<ENTRY>Overlaps to right?</ENTRY>
	<ENTRY>'((0,0),(3,3))'::box &amp;&gt; '((0,0),(2,2))'::box</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;-&gt; </ENTRY>
	<ENTRY>Distance between</ENTRY>
	<ENTRY>'((0,0),1)'::circle &lt;-&gt; '((5,0),1)'::circle</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;&lt; </ENTRY>
	<ENTRY>Left of?</ENTRY>
	<ENTRY>'((0,0),1)'::circle &lt;&lt; '((5,0),1)'::circle</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;^ </ENTRY>
	<ENTRY>Is below?</ENTRY>
	<ENTRY>'((0,0),1)'::circle &lt;^ '((0,5),1)'::circle</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt;&gt; </ENTRY>
	<ENTRY>Is right of?</ENTRY>
	<ENTRY>'((5,0),1)'::circle &gt;&gt; '((0,0),1)'::circle</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt;^ </ENTRY>
	<ENTRY>Is above?</ENTRY>
	<ENTRY>'((0,5),1)'::circle >^ '((0,0),1)'::circle</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ?# </ENTRY>
	<ENTRY>Intersects or overlaps</ENTRY>
	<ENTRY>'((-1,0),(1,0))'::lseg ?# '((-2,-2),(2,2))'::box;</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ?- </ENTRY>
	<ENTRY>Is horizontal?</ENTRY>
	<ENTRY>'(1,0)'::point ?- '(0,0)'::point</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ?-| </ENTRY>
	<ENTRY>Is perpendicular?</ENTRY>
	<ENTRY>'((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> @-@  </ENTRY>
	<ENTRY>Length or circumference</ENTRY>
	<ENTRY>@-@ '((0,0),(1,0))'::path</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ?| </ENTRY>
	<ENTRY>Is vertical?</ENTRY>
	<ENTRY>'(0,1)'::point ?| '(0,0)'::point</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ?|| </ENTRY>
	<ENTRY>Is parallel?</ENTRY>
	<ENTRY>'((-1,0),(1,0))'::lseg ?|| '((-1,2),(1,2))'::lseg</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> @ </ENTRY>
	<ENTRY>Contained or on</ENTRY>
	<ENTRY>'(1,1)'::point @ '((0,0),2)'::circle</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> @@ </ENTRY>
	<ENTRY>Center of</ENTRY>
	<ENTRY>@@ '((0,0),10)'::circle</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ~= </ENTRY>
	<ENTRY>Same as</ENTRY>
	<ENTRY>'((0,0),(1,1))'::polygon ~= '((1,1),(0,0))'::polygon</ENTRY>
       </ROW>
      </TBODY>
     </TGROUP>
    </TABLE>
   </Para>
  </sect1>
  
  <sect1>
   <title>Time Interval Operators</title>
   
   <Para>
    The time interval data type <Type>tinterval</Type> is a legacy from the original
    date/time types and is not as well supported as the more modern types. There
    are several operators for this type.
    
    <TABLE TOCENTRY="1">
     <TITLE><ProductName>Postgres</ProductName> Time Interval Operators</TITLE>
     <TITLEABBREV>Operators</TITLEABBREV>
     <TGROUP COLS="3">
      <THEAD>
       <ROW>
	<ENTRY>Operator</ENTRY>
	<ENTRY>Description</ENTRY>
	<ENTRY>Usage</ENTRY>
       </ROW>
      </THEAD>
      <TBODY>
       <ROW>
	<ENTRY> #&lt; </ENTRY>
	<ENTRY>Interval less than?</ENTRY>
	<ENTRY></ENTRY>
       </ROW>
       <ROW>
	<ENTRY> #&lt;= </ENTRY>
	<ENTRY>Interval less than or equal to?</ENTRY>
	<ENTRY></ENTRY>
       </ROW>
       <ROW>
	<ENTRY> #&lt;&gt; </ENTRY>
	<ENTRY>Interval not equal?</ENTRY>
	<ENTRY></ENTRY>
       </ROW>
       <ROW>
	<ENTRY> #= </ENTRY>
	<ENTRY>Interval equal?</ENTRY>
	<ENTRY></ENTRY>
       </ROW>
       <ROW>
	<ENTRY> #&gt; </ENTRY>
	<ENTRY>Interval greater than?</ENTRY>
	<ENTRY></ENTRY>
       </ROW>
       <ROW>
	<ENTRY> #&gt;= </ENTRY>
	<ENTRY>Interval greater than or equal to?</ENTRY>
	<ENTRY></ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;#&gt; </ENTRY>
	<ENTRY>Convert to time interval</ENTRY>
	<ENTRY></ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;&lt; </ENTRY>
	<ENTRY>Interval less than?</ENTRY>
	<ENTRY></ENTRY>
       </ROW>
       <ROW>
	<ENTRY> | </ENTRY>
	<ENTRY>Start of interval</ENTRY>
	<ENTRY></ENTRY>
       </ROW>
       <ROW>
	<ENTRY> ~= </ENTRY>
	<ENTRY>Same as</ENTRY>
	<ENTRY></ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;?&gt; </ENTRY>
	<ENTRY>Time inside interval?</ENTRY>
	<ENTRY></ENTRY>
       </ROW>
      </TBODY>
     </TGROUP>
    </TABLE>
   </Para>
  </sect1>
736

737 738
  <Sect1>
   <title id="cidr-opers">IP V4 CIDR Operators</title>
739

740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807
   <Para>
    <TABLE TOCENTRY="1">
     <TITLE><ProductName>Postgres</ProductName>IP V4 CIDR Operators</TITLE>
     <TITLEABBREV>Operators</TITLEABBREV>
     <TGROUP COLS="3">
      <THEAD>
       <ROW>
	<ENTRY>Operator</ENTRY>
	<ENTRY>Description</ENTRY>
	<ENTRY>Usage</ENTRY>
       </ROW>
      </THEAD>
      <TBODY>
       <ROW>
	<ENTRY> &lt; </ENTRY>
	<ENTRY>Less than</ENTRY>
	<ENTRY>'192.168.1.5'::cidr &lt; '192.168.1.6'::cidr</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;= </ENTRY>
	<ENTRY>Less than or equal</ENTRY>
	<ENTRY>'192.168.1.5'::cidr &lt;= '192.168.1.5'::cidr</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> = </ENTRY>
	<ENTRY>Equals</ENTRY>
	<ENTRY>'192.168.1.5'::cidr = '192.168.1.5'::cidr</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt;= </ENTRY>
	<ENTRY>Greater or equal</ENTRY>
	<ENTRY>'192.168.1.5'::cidr &gt;= '192.168.1.5'::cidr</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt; </ENTRY>
	<ENTRY>Greater</ENTRY>
	<ENTRY>'192.168.1.5'::cidr &gt; '192.168.1.4'::cidr</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;&gt; </ENTRY>
	<ENTRY>Not equal</ENTRY>
	<ENTRY>'192.168.1.5'::cidr &lt;&gt; '192.168.1.4'::cidr</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;&lt; </ENTRY>
	<ENTRY>is contained within</ENTRY>
	<ENTRY>'192.168.1.5'::cidr &lt;&lt; '192.168.1/24'::cidr</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;&lt;= </ENTRY>
	<ENTRY>is contained within or equals</ENTRY>
	<ENTRY>'192.168.1/24'::cidr &lt;&lt;= '192.168.1/24'::cidr</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt;&gt; </ENTRY>
	<ENTRY>contains</ENTRY>
	<ENTRY>'192.168.1/24'::cidr &gt;&gt; '192.168.1.5'::cidr</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt;&gt;= </ENTRY>
	<ENTRY>contains or equals</ENTRY>
	<ENTRY>'192.168.1/24'::cidr &gt;&gt;= '192.168.1/24'::cidr</ENTRY>
       </ROW>
      </TBODY>
     </TGROUP>
    </TABLE>
   </Para>
  </Sect1>
808

809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879
  <Sect1>
   <title id="inet-opers">IP V4 INET Operators</title>
   
   <Para>
    <TABLE TOCENTRY="1">
     <TITLE><ProductName>Postgres</ProductName>IP V4 INET Operators</TITLE>
     <TITLEABBREV>Operators</TITLEABBREV>
     <TGROUP COLS="3">
      <THEAD>
       <ROW>
	<ENTRY>Operator</ENTRY>
	<ENTRY>Description</ENTRY>
	<ENTRY>Usage</ENTRY>
       </ROW>
      </THEAD>
      <TBODY>
       <ROW>
	<ENTRY> &lt; </ENTRY>
	<ENTRY>Less than</ENTRY>
	<ENTRY>'192.168.1.5'::inet &lt; '192.168.1.6'::inet</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;= </ENTRY>
	<ENTRY>Less than or equal</ENTRY>
	<ENTRY>'192.168.1.5'::inet &lt;= '192.168.1.5'::inet</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> = </ENTRY>
	<ENTRY>Equals</ENTRY>
	<ENTRY>'192.168.1.5'::inet = '192.168.1.5'::inet</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt;= </ENTRY>
	<ENTRY>Greater or equal</ENTRY>
	<ENTRY>'192.168.1.5'::inet &gt;= '192.168.1.5'::inet</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt; </ENTRY>
	<ENTRY>Greater</ENTRY>
	<ENTRY>'192.168.1.5'::inet &gt; '192.168.1.4'::inet</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;&gt; </ENTRY>
	<ENTRY>Not equal</ENTRY>
	<ENTRY>'192.168.1.5'::inet &lt;&gt; '192.168.1.4'::inet</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;&lt; </ENTRY>
	<ENTRY>is contained within</ENTRY>
	<ENTRY>'192.168.1.5'::inet &lt;&lt; '192.168.1/24'::inet</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &lt;&lt;= </ENTRY>
	<ENTRY>is contained within or equals</ENTRY>
	<ENTRY>'192.168.1/24'::inet &lt;&lt;= '192.168.1/24'::inet</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt;&gt; </ENTRY>
	<ENTRY>contains</ENTRY>
	<ENTRY>'192.168.1/24'::inet &gt;&gt; '192.168.1.5'::inet</ENTRY>
       </ROW>
       <ROW>
	<ENTRY> &gt;&gt;= </ENTRY>
	<ENTRY>contains or equals</ENTRY>
	<ENTRY>'192.168.1/24'::inet &gt;&gt;= '192.168.1/24'::inet</ENTRY>
       </ROW>
      </TBODY>
     </TGROUP>
    </TABLE>
   </Para>
  </Sect1>
880

881
 </Chapter>
882

883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"./reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/CATALOG"
sgml-local-ecat-files:nil
End:
-->