4.3.2. Using Named Notation

4.3.2. Using Named Notation
4.3.2.使用命名表示法
In named notation, each argument's name is specified using => to separate it from the argument expression. For example:
命名表示法中,所有参数名字使用=>限定以对应参数表达式。例如:
 
SELECT concat_lower_or_upper(a => 'Hello', b => 'World');
concat_lower_or_upper
-----------------------
hello world
(1 row)
 
Again, the argument uppercase was omitted so it is set to false implicitly. One advantage of  using named notation is that the arguments may be specified in any order, for example:
此处,uppercase因为被忽略,所以隐式的使用值false。使用命名表示法的优点在于,可以随意指定参数顺序,例如:
 
SELECT concat_lower_or_upper(a => 'Hello', b => 'World', uppercase=> true);
concat_lower_or_upper
-----------------------
HELLO WORLD
(1 row)
SELECT concat_lower_or_upper(a => 'Hello', uppercase => true, b =>'World');
concat_lower_or_upper
-----------------------
HELLO WORLD
(1 row)
An older syntax based on ":=" is supported for backward compatibility:
为了向前兼容,之前的基于“:=”的语法也是支持的:
 
SELECT concat_lower_or_upper(a := 'Hello', uppercase := true, b :='World');
concat_lower_or_upper
-----------------------
HELLO WORLD
(1 row)
 
发布了341 篇原创文章 · 获赞 53 · 访问量 88万+

猜你喜欢

转载自blog.csdn.net/ghostliming/article/details/104307797