pgsql 常用命令- \d [ table ] 列出数据库中的表,或(如果声明了)表 table 的列/字段.如果表名是用统配符 (“*”)声明的,列出所有表和表的列/字段信息. \da 列出所有可用聚集. \dd object 列出 pg_description 里对声明的对象的
select c.relname 表名,cast(obj_description(relfilenode,'pg_class') as varchar) 名称,a.attname 字段,d.description 字段备注,concat_ws('',t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from '\(.*\)')) as 列类型 from pg_class c,pg_attribute a,pg_type t,pg_description d ...
description 作为对该对象的描述的任意文本 查询用户表 SELECT a.oid, a.relname AS name, b.description AS comment FROM pg_class a LEFT OUTER JOIN pg_description b ON b.objsubid=0 AND a.oid = b.objoid WHERE a.relnamespace = (SELECT oid FROM pg_namespace WHERE nspname='public') --用...
pgsql_type(pg_type.typname::varchar) AS fields_type, pg_attribute.atttypmod-4 as fields_length, CASE WHEN pg_attribute.attnotnull THEN ''not null'' ELSE ''' END AS fields_not_null, pg_get_expr(pg_attrdef.adbin, pg_attrdef.adrelid) AS fields_default, pg_description.description AS ...
cast(obj_description(pg_class.relfilenode,'pg_class') as varchar) as 表中文描述, '' as 表类型, '' as 表创建时间, pg_attribute.attnum as 字段编号, pg_attribute.attname as 字段名, col_description(pg_attribute.attrelid,pg_attribute.attnum) as 字段描述, ...
B.description as description , CASE WHEN length(B.attname) >0 THEN 1 ELSE NULL END AS pk_name FROM information_schema.columns A LEFT JOIN( SELECT pg_attribute.attname, pg_attribute.attnum,pg_description.description as description FROM pg_index, pg_class, pg_attribute ,pg_description ...
mydb=# ALTER TYPE mood ADD VALUE IF NOT EXISTS 'happier' AFTER 'happy'; mydb=# \dT+ mood; List of data types Schema | Name | Internal name | Size | Elements | Owner | Access privileges | Description ---+---+---+---+---+---+---+--- public | mood | mood | 4 | sad...
(12.5)Type"help"forhelp.postgres=# create tablespace mytbs location '/opt/custome-tablespace';CREATETABLESPACEpostgres=# \db+Listof tablespacesName|Owner|Location|Accessprivileges|Options|Size|Description---+---+---+---+---+---+---mytbs|postgres|/opt/custome-tablespace|||0bytes|pg_defaul...
pg_description 是保存注释信息的系统表,但是比较尴尬的是,只保存了他所在属性列的id pg_class 表记载表和几乎所有有 字段或者是那些类似表的东西。包括索引(不过还要参阅pg_index),序列,视图,复合类型和一些特殊关系类型 pg_attribute 这个表存储了所有属性列 ...