4.1.3. Operators
4.1.3. 操作符
An operator name is a sequence of up to NAMEDATALEN-1 (63 by default) characters from the following list:
运算符名称是含以下列表中最多NAMEDATALEN-1(默认为63)个字符的序列:
+ - * / < > = ~ ! @ # % ^ & | ` ?
There are a few restrictions on operator names, however:
• -- and /* cannot appear anywhere in an operator name, since they will be taken as the start of a comment.
• A multiple-character operator name cannot end in + or -, unless the name also contains at least one of these characters:
但是,对运算符名称有一定的限制:
-
运算符名称中不能出现--和/*,因为它们会被认为是备注的一部分。
-
多字符运算符名称不能以+或-结尾,除非名称也包含以下至少一个字符:
~ ! @ # % ^ & | ` ?
For example, @- is an allowed operator name, but *- is not. This restriction allows PostgreSQL to parse SQL-compliant queries without requiring spaces between tokens.
例如,@-是一个可用的运算符名称,但是*-不是。 此限制使PostgreSQL可以解析与SQL兼容的查询,而无需在标记之间使用空格。
When working with non-SQL-standard operator names, you will usually need to separate adjacent operators with spaces to avoid ambiguity. For example, if you have defined a left unary operator named @, you cannot write X*@Y; you must write X* @Y to ensure that PostgreSQL reads it as two operator names not one.
在使用非SQL标准的运算符名称时,通常需要用空格分隔相邻的运算符,以避免产生歧义。 例如,如果定义了名为@的左一元运算符,则不能编写X*@Y; 您必须编写X* @Y以确保PostgreSQL将其读取为两个运算符名称,而不是一个。