postgresql_16:3.1.2 Value Expressions
PostgreSQL 16 > The SQL Language > SQL Syntax > Value Expressions
Value expressions are used in a variety of contexts, such as in the target list of the SELECT command, as new column values in INSERT or UPDATE, or in search conditions in a number of commands. The result of a value expression is sometimes called a *scalar*, to distinguish it from the result of a table expression (which is a table). Value expressions are therefore also called *scalar expressions* (or even simply *expressions*). The expression syntax allows the calculation of values from primitive parts using arithmetic, logical, set, and other operations.
A value expression is one of the following: A constant or literal value A column reference A positional parameter reference, in the body of a function definition or prepared statement A subscripted expression A field selection expression An operator invocation A function call An aggregate expression A window function call A type cast A collation expression A scalar subquery An array constructor A row constructor Another value expression in parentheses (used to group subexpressions and override precedence)
In addition to this list, there are a number of constructs that can be classified as an expression but do not follow any general syntax rules. These generally have the semantics of a function or operator and are explained in the appropriate location in (see postgresql_16:3.6). An example is the IS NULL clause.
We have already discussed constants in (see postgresql_16:3.1.1.2). The following sections discuss the remaining options.
Subsections
- postgresql_16:3.1.2.1 Column References
- postgresql_16:3.1.2.2 Positional Parameters
- postgresql_16:3.1.2.3 Subscripts
- postgresql_16:3.1.2.4 Field Selection
- postgresql_16:3.1.2.5 Operator Invocations
- postgresql_16:3.1.2.6 Function Calls
- postgresql_16:3.1.2.7 Aggregate Expressions
- postgresql_16:3.1.2.8 Window Function Calls
- postgresql_16:3.1.2.9 Type Casts
- postgresql_16:3.1.2.10 Collation Expressions
- postgresql_16:3.1.2.11 Scalar Subqueries
- postgresql_16:3.1.2.12 Array Constructors
- postgresql_16:3.1.2.13 Row Constructors
- postgresql_16:3.1.2.14 Expression Evaluation Rules