value expression is one of the following:
<itemizedlist>
<listitem>
<para>
A constant or literal value
</para>
</listitem>
<listitem>
<para>
A column reference
</para>
</listitem>
<listitem>
<para>
A positional parameter reference, in the body of a function definition
or prepared statement
</para>
</listitem>
<listitem>
<para>
A subscripted expression
</para>
</listitem>
<listitem>
<para>
A field selection expression
</para>
</listitem>
<listitem>
<para>
An operator invocation
</para>
</listitem>
<listitem>
<para>
A function call
</para>
</listitem>
<listitem>
<para>
An aggregate expression
</para>
</listitem>
<listitem>
<para>
A window function call
</para>
</listitem>
<listitem>
<para>
A type cast
</para>
</listitem>
<listitem>
<para>
A collation expression
</para>
</listitem>
<listitem>
<para>
A scalar subquery
</para>
</listitem>
<listitem>
<para>
An array constructor
</para>
</listitem>
<listitem>
<para>
A row constructor
</para>
</listitem>
<listitem>
<para>
Another value expression in parentheses (used to group
subexpressions and override
precedence<indexterm><primary>parenthesis</primary></indexterm>)
</para>
</listitem>
</itemizedlist>
</para>
<para>
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 <xref
linkend="functions"/>. An example is the <literal>IS NULL</literal>
clause.
</para>
<para>
We have already discussed constants in <xref
linkend="sql-syntax-constants"/>. The following sections discuss
the remaining options.
</para>
<sect2 id="sql-expressions-column-refs">
<title>Column References</title>
<indexterm>
<primary>column reference</primary>
</indexterm>
<para>
A column can be referenced in the form:
<synopsis>
<replaceable>correlation</replaceable>.<replaceable>columnname</replaceable>
</synopsis>
</para>
<para>
<replaceable>correlation</replaceable> is the name of a
table (possibly qualified with a schema name), or an alias for a table
defined by means of a <literal>FROM</literal> clause.
The correlation name and separating dot can be omitted if the column name
is unique across all the tables being used in the current query. (See also <xref linkend="queries"/>.)
</para>
</sect2>
<sect2 id="sql-expressions-parameters-positional">
<title>Positional Parameters</title>
<indexterm>
<primary>parameter</primary>
<secondary>syntax</secondary>
</indexterm>
<indexterm>
<primary>$</primary>
</indexterm>
<para>
A positional parameter reference is used to indicate a value
that is supplied externally to an SQL statement. Parameters are
used in SQL function definitions and in prepared queries. Some
client libraries also support specifying data values separately
from the SQL command string, in which case parameters are used to
refer to the out-of-line data values.
The form of a parameter reference is:
<synopsis>
$<replaceable>number</replaceable>
</synopsis>
</para>
<para>
For example, consider the definition of a function,
<function>dept</function>, as:
<programlisting>
CREATE FUNCTION dept(text) RETURNS dept
AS $$ SELECT * FROM dept WHERE name = $1 $$
LANGUAGE SQL;
</programlisting>
Here the <literal>$1</literal> references the value of the first
function argument whenever the function is invoked.
</para>
</sect2>
<sect2 id="sql-expressions-subscripts">