pg_operator 是一个 系统目录 表,用于存储有关操作符的信息。
pg_operator 一直存在于 PostgreSQL 中。
psql 命令
\do列出所有用户定义的操作符\doS列出内置操作符
按 PostgreSQL 版本定义
pg_operator (PostgreSQL 19)
Table "pg_catalog.pg_operator"
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+---------
oid | oid | | not null |
oprname | name | | not null |
oprnamespace | oid | | not null |
oprowner | oid | | not null |
oprkind | "char" | | not null |
oprcanmerge | boolean | | not null |
oprcanhash | boolean | | not null |
oprleft | oid | | not null |
oprright | oid | | not null |
oprresult | oid | | not null |
oprcom | oid | | not null |
oprnegate | oid | | not null |
oprcode | regproc | | not null |
oprrest | regproc | | not null |
oprjoin | regproc | | not null |
Indexes:
"pg_operator_oid_index" PRIMARY KEY, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE CONSTRAINT, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 18)
Table "pg_catalog.pg_operator"
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+---------
oid | oid | | not null |
oprname | name | | not null |
oprnamespace | oid | | not null |
oprowner | oid | | not null |
oprkind | "char" | | not null |
oprcanmerge | boolean | | not null |
oprcanhash | boolean | | not null |
oprleft | oid | | not null |
oprright | oid | | not null |
oprresult | oid | | not null |
oprcom | oid | | not null |
oprnegate | oid | | not null |
oprcode | regproc | | not null |
oprrest | regproc | | not null |
oprjoin | regproc | | not null |
Indexes:
"pg_operator_oid_index" PRIMARY KEY, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE CONSTRAINT, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 17)
Table "pg_catalog.pg_operator"
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+---------
oid | oid | | not null |
oprname | name | | not null |
oprnamespace | oid | | not null |
oprowner | oid | | not null |
oprkind | "char" | | not null |
oprcanmerge | boolean | | not null |
oprcanhash | boolean | | not null |
oprleft | oid | | not null |
oprright | oid | | not null |
oprresult | oid | | not null |
oprcom | oid | | not null |
oprnegate | oid | | not null |
oprcode | regproc | | not null |
oprrest | regproc | | not null |
oprjoin | regproc | | not null |
Indexes:
"pg_operator_oid_index" PRIMARY KEY, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE CONSTRAINT, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 16)
Table "pg_catalog.pg_operator"
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+---------
oid | oid | | not null |
oprname | name | | not null |
oprnamespace | oid | | not null |
oprowner | oid | | not null |
oprkind | "char" | | not null |
oprcanmerge | boolean | | not null |
oprcanhash | boolean | | not null |
oprleft | oid | | not null |
oprright | oid | | not null |
oprresult | oid | | not null |
oprcom | oid | | not null |
oprnegate | oid | | not null |
oprcode | regproc | | not null |
oprrest | regproc | | not null |
oprjoin | regproc | | not null |
Indexes:
"pg_operator_oid_index" PRIMARY KEY, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE CONSTRAINT, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 15)
Table "pg_catalog.pg_operator"
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+---------
oid | oid | | not null |
oprname | name | | not null |
oprnamespace | oid | | not null |
oprowner | oid | | not null |
oprkind | "char" | | not null |
oprcanmerge | boolean | | not null |
oprcanhash | boolean | | not null |
oprleft | oid | | not null |
oprright | oid | | not null |
oprresult | oid | | not null |
oprcom | oid | | not null |
oprnegate | oid | | not null |
oprcode | regproc | | not null |
oprrest | regproc | | not null |
oprjoin | regproc | | not null |
Indexes:
"pg_operator_oid_index" PRIMARY KEY, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE CONSTRAINT, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 14)
Table "pg_catalog.pg_operator"
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+---------
oid | oid | | not null |
oprname | name | | not null |
oprnamespace | oid | | not null |
oprowner | oid | | not null |
oprkind | "char" | | not null |
oprcanmerge | boolean | | not null |
oprcanhash | boolean | | not null |
oprleft | oid | | not null |
oprright | oid | | not null |
oprresult | oid | | not null |
oprcom | oid | | not null |
oprnegate | oid | | not null |
oprcode | regproc | | not null |
oprrest | regproc | | not null |
oprjoin | regproc | | not null |
Indexes:
"pg_operator_oid_index" PRIMARY KEY, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE CONSTRAINT, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 13)
Table "pg_catalog.pg_operator"
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+---------
oid | oid | | not null |
oprname | name | | not null |
oprnamespace | oid | | not null |
oprowner | oid | | not null |
oprkind | "char" | | not null |
oprcanmerge | boolean | | not null |
oprcanhash | boolean | | not null |
oprleft | oid | | not null |
oprright | oid | | not null |
oprresult | oid | | not null |
oprcom | oid | | not null |
oprnegate | oid | | not null |
oprcode | regproc | | not null |
oprrest | regproc | | not null |
oprjoin | regproc | | not null |
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 12)
Table "pg_catalog.pg_operator"
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+---------
oid | oid | | not null |
oprname | name | | not null |
oprnamespace | oid | | not null |
oprowner | oid | | not null |
oprkind | "char" | | not null |
oprcanmerge | boolean | | not null |
oprcanhash | boolean | | not null |
oprleft | oid | | not null |
oprright | oid | | not null |
oprresult | oid | | not null |
oprcom | oid | | not null |
oprnegate | oid | | not null |
oprcode | regproc | | not null |
oprrest | regproc | | not null |
oprjoin | regproc | | not null |
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 11)
Table "pg_catalog.pg_operator"
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+---------
oprname | name | | not null |
oprnamespace | oid | | not null |
oprowner | oid | | not null |
oprkind | "char" | | not null |
oprcanmerge | boolean | | not null |
oprcanhash | boolean | | not null |
oprleft | oid | | not null |
oprright | oid | | not null |
oprresult | oid | | not null |
oprcom | oid | | not null |
oprnegate | oid | | not null |
oprcode | regproc | | not null |
oprrest | regproc | | not null |
oprjoin | regproc | | not null |
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 10)
Table "pg_catalog.pg_operator"
Column | Type | Collation | Nullable | Default
--------------+---------+-----------+----------+---------
oprname | name | | not null |
oprnamespace | oid | | not null |
oprowner | oid | | not null |
oprkind | "char" | | not null |
oprcanmerge | boolean | | not null |
oprcanhash | boolean | | not null |
oprleft | oid | | not null |
oprright | oid | | not null |
oprresult | oid | | not null |
oprcom | oid | | not null |
oprnegate | oid | | not null |
oprcode | regproc | | not null |
oprrest | regproc | | not null |
oprjoin | regproc | | not null |
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 9.6)
Table "pg_catalog.pg_operator"
Column | Type | Modifiers
--------------+---------+-----------
oprname | name | not null
oprnamespace | oid | not null
oprowner | oid | not null
oprkind | "char" | not null
oprcanmerge | boolean | not null
oprcanhash | boolean | not null
oprleft | oid | not null
oprright | oid | not null
oprresult | oid | not null
oprcom | oid | not null
oprnegate | oid | not null
oprcode | regproc | not null
oprrest | regproc | not null
oprjoin | regproc | not null
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 9.5)
Table "pg_catalog.pg_operator"
Column | Type | Modifiers
--------------+---------+-----------
oprname | name | not null
oprnamespace | oid | not null
oprowner | oid | not null
oprkind | "char" | not null
oprcanmerge | boolean | not null
oprcanhash | boolean | not null
oprleft | oid | not null
oprright | oid | not null
oprresult | oid | not null
oprcom | oid | not null
oprnegate | oid | not null
oprcode | regproc | not null
oprrest | regproc | not null
oprjoin | regproc | not null
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 9.4)
Table "pg_catalog.pg_operator"
Column | Type | Modifiers
--------------+---------+-----------
oprname | name | not null
oprnamespace | oid | not null
oprowner | oid | not null
oprkind | "char" | not null
oprcanmerge | boolean | not null
oprcanhash | boolean | not null
oprleft | oid | not null
oprright | oid | not null
oprresult | oid | not null
oprcom | oid | not null
oprnegate | oid | not null
oprcode | regproc | not null
oprrest | regproc | not null
oprjoin | regproc | not null
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 9.3)
Table "pg_catalog.pg_operator"
Column | Type | Modifiers
--------------+---------+-----------
oprname | name | not null
oprnamespace | oid | not null
oprowner | oid | not null
oprkind | "char" | not null
oprcanmerge | boolean | not null
oprcanhash | boolean | not null
oprleft | oid | not null
oprright | oid | not null
oprresult | oid | not null
oprcom | oid | not null
oprnegate | oid | not null
oprcode | regproc | not null
oprrest | regproc | not null
oprjoin | regproc | not null
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 9.2)
Table "pg_catalog.pg_operator"
Column | Type | Modifiers
--------------+---------+-----------
oprname | name | not null
oprnamespace | oid | not null
oprowner | oid | not null
oprkind | "char" | not null
oprcanmerge | boolean | not null
oprcanhash | boolean | not null
oprleft | oid | not null
oprright | oid | not null
oprresult | oid | not null
oprcom | oid | not null
oprnegate | oid | not null
oprcode | regproc | not null
oprrest | regproc | not null
oprjoin | regproc | not null
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 9.1)
Table "pg_catalog.pg_operator"
Column | Type | Modifiers
--------------+---------+-----------
oprname | name | not null
oprnamespace | oid | not null
oprowner | oid | not null
oprkind | "char" | not null
oprcanmerge | boolean | not null
oprcanhash | boolean | not null
oprleft | oid | not null
oprright | oid | not null
oprresult | oid | not null
oprcom | oid | not null
oprnegate | oid | not null
oprcode | regproc | not null
oprrest | regproc | not null
oprjoin | regproc | not null
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 9.0)
Table "pg_catalog.pg_operator"
Column | Type | Modifiers
--------------+---------+-----------
oprname | name | not null
oprnamespace | oid | not null
oprowner | oid | not null
oprkind | "char" | not null
oprcanmerge | boolean | not null
oprcanhash | boolean | not null
oprleft | oid | not null
oprright | oid | not null
oprresult | oid | not null
oprcom | oid | not null
oprnegate | oid | not null
oprcode | regproc | not null
oprrest | regproc | not null
oprjoin | regproc | not null
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 8.4)
Table "pg_catalog.pg_operator"
Column | Type | Modifiers
--------------+---------+-----------
oprname | name | not null
oprnamespace | oid | not null
oprowner | oid | not null
oprkind | "char" | not null
oprcanmerge | boolean | not null
oprcanhash | boolean | not null
oprleft | oid | not null
oprright | oid | not null
oprresult | oid | not null
oprcom | oid | not null
oprnegate | oid | not null
oprcode | regproc | not null
oprrest | regproc | not null
oprjoin | regproc | not null
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 8.3)
Table "pg_catalog.pg_operator"
Column | Type | Modifiers
--------------+---------+-----------
oprname | name | not null
oprnamespace | oid | not null
oprowner | oid | not null
oprkind | "char" | not null
oprcanmerge | boolean | not null
oprcanhash | boolean | not null
oprleft | oid | not null
oprright | oid | not null
oprresult | oid | not null
oprcom | oid | not null
oprnegate | oid | not null
oprcode | regproc | not null
oprrest | regproc | not null
oprjoin | regproc | not null
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
pg_operator (PostgreSQL 8.2)
Table "pg_catalog.pg_operator"
Column | Type | Modifiers
--------------+---------+-----------
oprname | name | not null
oprnamespace | oid | not null
oprowner | oid | not null
oprkind | "char" | not null
oprcanhash | boolean | not null
oprleft | oid | not null
oprright | oid | not null
oprresult | oid | not null
oprcom | oid | not null
oprnegate | oid | not null
oprlsortop | oid | not null
oprrsortop | oid | not null
oprltcmpop | oid | not null
oprgtcmpop | oid | not null
oprcode | regproc | not null
oprrest | regproc | not null
oprjoin | regproc | not null
Indexes:
"pg_operator_oid_index" UNIQUE, btree (oid)
"pg_operator_oprname_l_r_n_index" UNIQUE, btree (oprname, oprleft, oprright, oprnamespace)
文档: pg_operator
变更历史
- PostgreSQL 14
- 列
oprkind不再包含 'r'(提交 1ed6b895)
- 列
- PostgreSQL 8.3
- PostgreSQL 7.3 - 移除了以下列(提交 739adf32)
oprprecoprisleft
注意:此列表未反映 PostgreSQL 7.3 之前的任何更改。
示例
postgres=# SELECT * FROM pg_operator WHERE oprname = '!';
oid | oprname | oprnamespace | oprowner | oprkind | oprcanmerge | oprcanhash | oprleft | oprright | oprresult | oprcom | oprnegate | oprcode | oprrest | oprjoin
-----+---------+--------------+----------+---------+-------------+------------+---------+----------+-----------+--------+-----------+-------------+---------+---------
388 | ! | 11 | 10 | r | f | f | 20 | 0 | 1700 | 0 | 0 | numeric_fac | - | -
(1 row)
postgres=# \do !
List of operators
Schema | Name | Left arg type | Right arg type | Result type | Description
------------+------+---------------+----------------+-------------+-------------
pg_catalog | ! | bigint | | numeric | factorial
(1 row)
参考资料
- PostgreSQL 文档: pg_operator
