dotnetcore / SmartCode

SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything!!!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

查询 Postgresql 的表/视图描述

beginor opened this issue · comments

貌似 SmartCode 还不能将 pg 数据库的表/视图描述查询出来, 通过下面的语句可以查询出表/视图的描述, 希望能够加入到 SmartCode 的代码中,不知道有没有错误, 希望再检查一下。

(SELECT
T.tablename AS "Name",
'T' AS "TypeName",
obj_description(C.oid) As "Description"
FROM
pg_tables T
left join pg_class C on C.relname = T.tablename and C.relkind = 'r'
WHERE
schemaname = @DbSchema)
UNION ALL
(SELECT
V.viewname AS "Name",
'V' AS "TypeName",
obj_description(C.oid) as "Description"
FROM
pg_views V
left join pg_class C on C.relname = V.viewname and C.relkind = 'v'
WHERE
schemaname = @DbSchema)

ok,谢谢!

@beginor 下次调试一下,直接提交PR吧。

很多东西我都是魔改的, 怕你不接受