Полезная информация

Chapter 4. Functions and Operators

Table of Contents
4.1. Logical Operators
4.2. Comparison Operators
4.3. Mathematical Functions and Operators
4.4. String Functions and Operators
4.5. Binary String Functions and Operators
4.6. Pattern Matching
4.6.1. Pattern Matching with LIKE
4.6.2. POSIX Regular Expressions
4.7. Data Type Formatting Functions
4.8. Date/Time Functions and Operators
4.8.1. EXTRACT, date_part
4.8.2. date_trunc
4.8.3. Current Date/Time
4.9. Geometric Functions and Operators
4.10. Network Address Type Functions
4.11. Sequence-Manipulation Functions
4.12. Conditional Expressions
4.13. Miscellaneous Functions
4.14. Aggregate Functions
4.15. Subquery Expressions

PostgreSQL provides a large number of functions and operators for the built-in data types. Users can also define their own functions and operators, as described in the Programmer's Guide. The psql commands \df and \do can be used to show the list of all actually available functions and operators, respectively.

If you are concerned about portability then take note that most of the functions and operators described in this chapter, with the exception of the most trivial arithmetic and comparison operators and some explicitly marked functions, are not specified by the SQL standard. Some of this extended functionality is present in other RDBMS products, and in many cases this functionality is compatible and consistent between various products.

4.1. Logical Operators

The usual logical operators are available:


SQL uses a three-valued Boolean logic where NULL represents "unknown". Observe the following truth tables:

aba AND ba OR b

aNOT a