函数:to_regclass ( text ) → regclass The catalog pg_class:官文 The catalog pg_class catalogs tables and most everything else that has columns or is otherwise similar to a table. This includes indexes (but see als
-- 1、现有函数逻辑 -- 判断存在表的话(to_regclass (tb_name_partiton_val)),删除两月前的当日分区 drop table if exists ap.fact_ship_20220910; select to_regclass('fact_ship') ; --是否存在此表,不存在返回null,存在返回表名 -- 2、日期 select to_char(date_trunc('day',now())+'-1 day'...
regclasspg_class关系名pg_type regtypepg_type数据类型名integer regconfigpg_ts_config文本搜索配置english regdictionarypg_ts_dict文本搜索字典simple 伪类型 PostgreSQL类型系统包含一系列特殊用途的条目, 它们按照类别来说叫做伪类型。伪类型不能作为字段的数据类型, 但是它可以用于声明一个函数的参数或者结果类型。
to_regclass('"test"') AND c.relpersistence = 'u' LOG: DB node id: 1 backend pid: 6084 statement: select * from test; id --- 1 2 (2 rows) sbtest=# show pool_nodes; LOG: statement: show pool_nodes; node_id | hostname | port | status | lb_weight | role | select_cnt |...
(case when reltuples > 0 then postgres(# pg_relation_size('pg_proc')*reltuples/(8192*relpages) postgres(# else 0 postgres(# end)::bigint as estimated_row_count postgres-# from pg_class postgres-# where oid = 'pg_proc'::regclass; estimated_row_count --- 2490 (1 row) Time: 0....
id | integer | not null default nextval('tbl_xulie_id_seq'::regclass) name | text | david=# \d tbl_xulie2 Table "public.tbl_xulie2" Column | Type | Modifiers ---+---+--- id | integer | not null default nextval('tbl_xulie2_id_seq'::regclass) name | text | 1. ...
select locktype,datname,relation::regclass,page,tuple,virtualxid,transactionid::text,classid::regclass,objid,objsubid, string_agg( 'Pid: '||case when pid is null then 'NULL' else pid::text end||chr(10)|| 'Lock_Granted: '||case when granted is null then 'NULL' else granted::text ...
to_regclass,to_regproc, to_regprocedure,to_regoper, to_regoperator,to_regtype, to_regnamespace以及to_regrole 函数各自转换关系,函数,操作符,类型,模式以及角色名称为 regclass,regproc,regprocedure, regoper,regoperator,regtype, regnamespace以及regrole类型对象。 这些函数不同于来自不接受数字OID的文本...
if( to_regclass('public.log_save') is null ) then CREATE TABLE public.log_save ( id serial, log_type character varying(10), log_content text, insert_date timestamp without time zone, PRIMARY KEY (id) ) WITH ( OIDS = FALSE,
to_regclass('myschema.mytable')在Postgres 9.4+中使用可避免无效表名的例外情况:如何检查给定架构中是否存在表TABLESAMPLE SYSTEM (n) 在Postgres 9.5+SELECT 100 * count(*) AS estimate FROM mytable TABLESAMPLE SYSTEM (1);就像@a_horse commented一样,SELECT如果pg_class由于某些原因当前的统计信息不足,则...