postgresql 数据库 regclass 类型

os: centos 7.4
db: postgresql 10.11

版本

# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core) 
# 
# su - postgres
$
$ psql -c "select version();"
                                                 version                                                  
----------------------------------------------------------------------------------------------------------
 PostgreSQL 10.11 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit
(1 row)

regclass

$ psql
psql (10.11)
Type "help" for help.

postgres=# \timing on
Timing is on.
postgres=# 
postgres=# \d
                      List of relations
 Schema |             Name              |   Type   |  Owner   
--------+-------------------------------+----------+----------
 public | tmp_t5                        | table    | postgres
(1 rows)

postgres=# select to_regclass('tmp_t5'),pg_typeof(to_regclass('tmp_t5'));
 to_regclass | pg_typeof 
-------------+-----------
 tmp_t5      | regclass
(1 row)

Time: 0.493 ms

postgres=# select 'tmp_t5'::regclass,pg_typeof('tmp_t5'::regclass);
 regclass | pg_typeof 
----------+-----------
 tmp_t5   | regclass
(1 row)

Time: 0.408 ms

postgres=# select oid,relname,relkind from pg_class pc where pc.oid='tmp_t5'::regclass;
  oid   | relname | relkind 
--------+---------+---------
 132054 | tmp_t5  | r
(1 row)

Time: 341.652 ms

reg*

postgres=# select * from pg_type where typname like 'reg%' order by typname ;

    typname    | typnamespace | typowner | typlen | typbyval | typtype | typcategory | typispreferred | typisdefined | typdelim | typrelid | typelem | typarray |    typinput     |    typoutput     |    typreceive     |      typsend      | typmodin | typmodout | typanalyze | typalign | typstorage | typnotnull | typbasetype | typtypmod | typndims | typcollation | typdefaultbin | typdefault | typacl 
---------------+--------------+----------+--------+----------+---------+-------------+----------------+--------------+----------+----------+---------+----------+-----------------+------------------+-------------------+-------------------+----------+-----------+------------+----------+------------+------------+-------------+-----------+----------+--------------+---------------+------------+--------
 regclass      |           11 |       10 |      4 | t        | b       | N           | f              | t            | ,        |        0 |       0 |     2210 | regclassin      | regclassout      | regclassrecv      | regclasssend      | -        | -         | -          | i        | p          | f          |           0 |        -1 |        0 |            0 |               |            | 
 regconfig     |           11 |       10 |      4 | t        | b       | N           | f              | t            | ,        |        0 |       0 |     3735 | regconfigin     | regconfigout     | regconfigrecv     | regconfigsend     | -        | -         | -          | i        | p          | f          |           0 |        -1 |        0 |            0 |               |            | 
 regdictionary |           11 |       10 |      4 | t        | b       | N           | f              | t            | ,        |        0 |       0 |     3770 | regdictionaryin | regdictionaryout | regdictionaryrecv | regdictionarysend | -        | -         | -          | i        | p          | f          |           0 |        -1 |        0 |            0 |               |            | 
 regnamespace  |           11 |       10 |      4 | t        | b       | N           | f              | t            | ,        |        0 |       0 |     4090 | regnamespacein  | regnamespaceout  | regnamespacerecv  | regnamespacesend  | -        | -         | -          | i        | p          | f          |           0 |        -1 |        0 |            0 |               |            | 
 regoper       |           11 |       10 |      4 | t        | b       | N           | f              | t            | ,        |        0 |       0 |     2208 | regoperin       | regoperout       | regoperrecv       | regopersend       | -        | -         | -          | i        | p          | f          |           0 |        -1 |        0 |            0 |               |            | 
 regoperator   |           11 |       10 |      4 | t        | b       | N           | f              | t            | ,        |        0 |       0 |     2209 | regoperatorin   | regoperatorout   | regoperatorrecv   | regoperatorsend   | -        | -         | -          | i        | p          | f          |           0 |        -1 |        0 |            0 |               |            | 
 regproc       |           11 |       10 |      4 | t        | b       | N           | f              | t            | ,        |        0 |       0 |     1008 | regprocin       | regprocout       | regprocrecv       | regprocsend       | -        | -         | -          | i        | p          | f          |           0 |        -1 |        0 |            0 |               |            | 
 regprocedure  |           11 |       10 |      4 | t        | b       | N           | f              | t            | ,        |        0 |       0 |     2207 | regprocedurein  | regprocedureout  | regprocedurerecv  | regproceduresend  | -        | -         | -          | i        | p          | f          |           0 |        -1 |        0 |            0 |               |            | 
 regrole       |           11 |       10 |      4 | t        | b       | N           | f              | t            | ,        |        0 |       0 |     4097 | regrolein       | regroleout       | regrolerecv       | regrolesend       | -        | -         | -          | i        | p          | f          |           0 |        -1 |        0 |            0 |               |            | 
 regtype       |           11 |       10 |      4 | t        | b       | N           | f              | t            | ,        |        0 |       0 |     2211 | regtypein       | regtypeout       | regtyperecv       | regtypesend       | -        | -         | -          | i        | p          | f          |           0 |        -1 |        0 |            0 |               |            | 
(10 rows)

Time: 1.060 ms

参考:
http://www.postgres.cn/docs/10/datatype-oid.html
http://www.postgres.cn/docs/10/ddl-system-columns.html

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

数据库人生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值