4.3.3. Using Mixed Notation
4.3.3.使用复合表示法
The mixed notation combines positional and named notation. However, as already mentioned, named
arguments cannot precede positional arguments. For example:
复合表示法综合了位置和命名表示法。然而,如前所述,命名参数不能在位置参数前面。例如:
SELECT concat_lower_or_upper('Hello', 'World', uppercase => true);
concat_lower_or_upper
-----------------------
HELLO WORLD
(1 row)
In the above query, the arguments
a
and
b
are specified positionally, while
uppercase
is specified
by name. In this example, that adds little except documentation. With a more complex function having
numerous parameters that have default values, named or mixed notation can save a great deal of writing
and reduce chances for error.
上例中的查询,a和b参数使用位置表示法,uppercase使用了命名表示法。此例中,并没有多大改动。对
于具有许多默认值的参数的更复杂的函数,命名或混合表示法可以节省大量的编写工作并减少出错的机会。
Note
注
Named and mixed call notations currently cannot be used when calling an aggregate
function (but they do work when an aggregate function is used as a window function).
当调用聚合函数时,命名和混合调用表示法不能使用(但当聚合函数作为窗口函数使用时,可以使用。)