Chapter 10. Functions and Operators

Table of Contents

10.1. Logical Operators
10.2. Comparison Functions and Operators
10.3. Mathematical Functions and Operators
10.4. String Functions and Operators
10.4.1. format
10.5. Binary String Functions and Operators
10.6. Bit String Functions and Operators
10.7. Pattern Matching
10.7.1. LIKE
10.7.2. SIMILAR TO Regular Expressions
10.7.3. POSIX Regular Expressions
10.8. Data Type Formatting Functions
10.9. Date/Time Functions and Operators
10.9.1. EXTRACT, date_part
10.9.2. date_trunc
10.9.3. AT TIME ZONE
10.9.4. Current Date/Time
10.9.5. nls_date_format/nls_timestamp_format
10.9.6. Delaying Execution
10.10. Enum Support Functions
10.11. Network Address Functions and Operators
10.12. Text Search Functions and Operators
10.13. UUID Functions
10.14. XML Functions
10.14.1. Producing XML Content
10.14.2. XML Predicates
10.14.3. Processing XML
10.14.4. Mapping Tables to XML
10.15. JSON Functions and Operators
10.15.1. Processing and Creating JSON Data
10.15.2. The SQL/JSON Path Language
10.16. Sequence Manipulation Functions
10.17. Conditional Expressions
10.17.1. CASE
10.17.2. COALESCE
10.17.3. NULLIF
10.17.4. GREATEST and LEAST
10.17.5. NVL and NVL2
10.17.6. DECODE
10.18. Array Functions and Operators
10.19. Range Functions and Operators
10.20. Aggregate Functions
10.21. Window Functions
10.22. Subquery Expressions
10.22.1. EXISTS
10.22.2. IN
10.22.3. NOT IN
10.22.4. ANY/SOME
10.22.5. ALL
10.22.6. Single-Row Comparison
10.23. Row and Array Comparisons
10.23.1. IN
10.23.2. NOT IN
10.23.3. ANY/SOME (array)
10.23.4. ALL (array)
10.23.5. Row Constructor Comparison
10.23.6. Composite Type Comparison
10.24. Set Returning Functions
10.25. System Information Functions and Operators
10.25.1. Session Information Functions
10.25.2. Access Privilege Inquiry Functions
10.25.3. aclitem Operators
10.25.4. Schema Visibility Inquiry Functions
10.25.5. System Catalog Information Functions
10.25.6. Index Column Properties
10.25.7. Index Properties
10.25.8. Index Access Method Properties
10.25.9. Object Information and Addressing Functions
10.25.10. Comment Information Functions
10.25.11. Transaction ID and Snapshot Information Functions
10.25.12. Control File Data Functions
10.26. System Administration Functions
10.26.1. Configuration Settings Functions
10.26.2. Server Signaling Functions
10.26.3. Backup Control Functions
10.26.4. Recovery Control Functions
10.26.5. Snapshot Synchronization Functions
10.26.6. Replication Management Functions
10.26.7. Database Object Management Functions
10.26.8. Index Maintenance Functions
10.26.9. Generic File Access Functions
10.26.10. Advisory Lock Functions
10.27. Trigger Functions
10.28. Event Trigger Functions
10.28.1. Capturing Changes at Command End
10.28.2. Processing Objects Dropped by a DDL Command
10.28.3. Handling a Table Rewrite Event
10.29. Statistics Information Functions
10.29.1. Inspecting MCV Lists
10.30. Oracle Compatible Functions
10.30.1. Mathematical Functions
10.30.2. String Functions
10.30.3. Date/Time Functions
10.30.4. Data Type Formatting Functions
10.30.5. Conditional Expressions
10.30.6. Aggregate Functions
10.30.7. Functions That Return Internal Information
10.30.8. Datetime Operator
10.30.9. JSON Functions
10.30.10. Other functions
10.31. MySQL Compatible Functions
10.31.1. Mathematical Functions
10.31.2. String Functions
10.31.3. Date/Time Functions
10.31.4. JSON Functions
10.31.5. Conditional Expressions
10.31.6. Aggregate Functions
10.31.7. System Information Functions and Operators
10.31.8. Miscellaneous Functions
10.31.9. Operators
10.31.10. Arithmetic Operators
10.31.11. Compare Operators
10.31.12. Convert type
10.31.13. AES encryption and decryption

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.