Chapter 9. Functions and Operators

Table of Contents
9.1. Logical Operators
9.2. Comparison Functions and Operators
9.3. Mathematical Functions and Operators
9.4. String Functions and Operators
9.5. Binary String Functions and Operators
9.6. Bit String Functions and Operators
9.7. Pattern Matching
9.7.1. LIKE
9.7.2. SIMILAR TO Regular Expressions
9.7.3. POSIX Regular Expressions
9.8. Data Type Formatting Functions
9.9. Date/Time Functions and Operators
9.9.1. EXTRACT, date_part
9.9.2. date_trunc
9.9.3. AT TIME ZONE
9.9.4. Current Date/Time
9.9.5. Delaying Execution
9.10. Enum Support Functions
9.11. Geometric Functions and Operators
9.12. Network Address Functions and Operators
9.13. Text Search Functions and Operators
9.14. XML Functions
9.14.1. Producing XML Content
9.14.2. XML Predicates
9.14.3. Processing XML
9.14.4. Mapping Tables to XML
9.15. JSON Functions and Operators
9.16. Sequence Manipulation Functions
9.17. Conditional Expressions
9.17.1. CASE
9.17.2. COALESCE
9.17.3. NULLIF
9.17.4. GREATEST and LEAST
9.18. Array Functions and Operators
9.19. Range Functions and Operators
9.20. Aggregate Functions
9.21. Window Functions
9.22. Subquery Expressions
9.22.1. EXISTS
9.22.2. IN
9.22.3. NOT IN
9.22.4. ANY/SOME
9.22.5. ALL
9.22.6. Single-row Comparison
9.23. Row and Array Comparisons
9.23.1. IN
9.23.2. NOT IN
9.23.3. ANY/SOME (array)
9.23.4. ALL (array)
9.23.5. Row Constructor Comparison
9.23.6. Composite Type Comparison
9.24. Set Returning Functions
9.25. System Information Functions
9.26. System Administration Functions
9.26.1. Configuration Settings Functions
9.26.2. Server Signaling Functions
9.26.3. Backup Control Functions
9.26.4. Recovery Control Functions
9.26.5. Snapshot Synchronization Functions
9.26.6. Replication Functions
9.26.7. Database Object Management Functions
9.26.8. Index Maintenance Functions
9.26.9. Generic File Access Functions
9.26.10. Advisory Lock Functions
9.27. Trigger Functions
9.28. Event Trigger Functions
9.28.1. Capturing Changes at Command End
9.28.2. Processing Objects Dropped by a DDL Command
9.28.3. Handling a Table Rewrite Event

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 Part V. The psql commands \df and \do can be used to list all available functions and operators, respectively.

If you are concerned about portability then 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 SQL database management systems, and in many cases this functionality is compatible and consistent between the various implementations. This chapter is also not exhaustive; additional functions appear in relevant sections of the manual.