调用insert函数,将pg_class、pg_attribute这两张表的表描述信息和列描述信息存储到上述的数据字典表中,可以使用以下SQL语句:

-- 插入pg_class表的表描述信息
INSERT INTO 数据字典表 (表名, 表描述)
SELECT relname, description
FROM pg_class
WHERE relname IN ('pg_class', 'pg_attribute');

-- 插入pg_attribute表的列描述信息
INSERT INTO 数据字典表 (表名, 列名, 列描述)
SELECT attrelid::regclass::text, attname, description
FROM pg_attribute
WHERE attrelid IN (SELECT oid FROM pg_class WHERE relname IN ('pg_class', 'pg_attribute'))
AND description IS NOT NULL;

需要将"数据字典表"替换为实际的数据字典表名称。这两个INSERT语句将从pg_class和pg_attribute表中选择相关的描述信息,并插入到数据字典表中

调用insert函数将pg_class、pg_attribute这两张表的表描述信息和列描述信息存储到上述的数据字典表中。插入到文件

原文地址: https://www.cveoy.top/t/topic/hCLq 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录