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.4.1. format
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. nls_date_format/nls_timestamp_format
9.9.6. 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. UUID Functions
9.15. XML Functions
9.15.1. Producing XML Content
9.15.2. XML Predicates
9.15.3. Processing XML
9.15.4. Mapping Tables to XML
9.16. JSON Functions and Operators
9.16.1. Processing and Creating JSON Data
9.16.2. The SQL/JSON Path Language
9.17. Sequence Manipulation Functions
9.18. Conditional Expressions
9.18.1. CASE
9.18.2. COALESCE
9.18.3. NULLIF
9.18.4. GREATEST and LEAST
9.18.5. NVL and NVL2
9.19. Array Functions and Operators
9.20. Range Functions and Operators
9.21. Aggregate Functions
9.22. Window Functions
9.23. Subquery Expressions
9.23.1. EXISTS
9.23.2. IN
9.23.3. NOT IN
9.23.4. ANY/SOME
9.23.5. ALL
9.23.6. Single-Row Comparison
9.24. Row and Array Comparisons
9.24.1. IN
9.24.2. NOT IN
9.24.3. ANY/SOME (array)
9.24.4. ALL (array)
9.24.5. Row Constructor Comparison
9.24.6. Composite Type Comparison
9.25. Set Returning Functions
9.26. System Information Functions and Operators
9.26.1. Session Information Functions
9.26.2. Access Privilege Inquiry Functions
9.26.3. aclitem Operators
9.26.4. Schema Visibility Inquiry Functions
9.26.5. System Catalog Information Functions
9.26.6. Index Column Properties
9.26.7. Index Properties
9.26.8. Index Access Method Properties
9.26.9. Object Information and Addressing Functions
9.26.10. Comment Information Functions
9.26.11. Transaction ID and Snapshot Information Functions
9.26.12. Control File Data Functions
9.27. System Administration Functions
9.27.1. Configuration Settings Functions
9.27.2. Server Signaling Functions
9.27.3. Backup Control Functions
9.27.4. Recovery Control Functions
9.27.5. Snapshot Synchronization Functions
9.27.6. Replication Management Functions
9.27.7. Database Object Management Functions
9.27.8. Index Maintenance Functions
9.27.9. Generic File Access Functions
9.27.10. Advisory Lock Functions
9.28. Trigger Functions
9.29. Event Trigger Functions
9.29.1. Capturing Changes at Command End
9.29.2. Processing Objects Dropped by a DDL Command
9.29.3. Handling a Table Rewrite Event
9.30. Statistics Information Functions
9.30.1. Inspecting MCV Lists

LightDB provides a large number of functions and operators for the built-in data types. This chapter describes most of them, although additional special-purpose functions appear in relevant sections of the manual. Users can also define their own functions and operators, as described in Part V. The ltsql commands \df and \do can be used to list all available functions and operators, respectively.

The notation used throughout this chapter to describe the argument and result data types of a function or operator is like this:

repeat ( text, integer ) → text

which says that the function repeat takes one text and one integer argument and returns a result of type text. The right arrow is also used to indicate the result of an example, thus:

repeat('Pg', 4) → PgPgPgPg

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.