pg_get_keywords()
是一个系统函数,返回PostgreSQL识别到的所有SQL关键字。
pg_get_keywords()
在 PostgreSQL 8.4 中添加。
用法
pg_get_keywords () →
setof record (word
text
,catcode
"char
",barelabel
boolean
,catdesc
text
,baredesc
text
)
PostgreSQL 13 及更早版本
pg_get_keywords () → setof record (word
text
,catcode
"char
",catdesc
text
)
变更历史
- PostgreSQL 14
- 添加了以下输出列 (提交 06a7c315)
barelabel
baredesc
- 添加了以下输出列 (提交 06a7c315)
- PostgreSQL 8.4
- 添加 (提交 c63147d6)
示例
来自 pg_get_keywords()
的示例输出
postgres=# SELECT * FROM pg_get_keywords() ORDER BY random() LIMIT 10; word | catcode | barelabel | catdesc | baredesc -------------+---------+-----------+----------------------------------------------+------------------- recursive | U | t | unreserved | can be bare label old | U | t | unreserved | can be bare label time | C | t | unreserved (cannot be function or type name) | can be bare label implicit | U | t | unreserved | can be bare label publication | U | t | unreserved | can be bare label variadic | R | t | reserved | can be bare label function | U | t | unreserved | can be bare label xmlroot | C | t | unreserved (cannot be function or type name) | can be bare label execute | U | t | unreserved | can be bare label collation | T | t | reserved (can be function or type name) | can be bare label (10 rows)
PostgreSQL 13 及更早版本
postgres=# SELECT * FROM pg_get_keywords() ORDER BY random() LIMIT 10; word | catcode | catdesc -----------------+---------+---------------------------------------------- double | U | unreserved xmlparse | C | unreserved (cannot be function or type name) label | U | unreserved case | R | reserved current_time | R | reserved freeze | T | reserved (can be function or type name) substring | C | unreserved (cannot be function or type name) subscription | U | unreserved characteristics | U | unreserved family | U | unreserved (10 rows)
参考
- PostgreSQL 文档: 系统目录信息函数