如何在 PostgreSQL 中查看视图的 CREATE VIEW 代码? [英] How to see the CREATE VIEW code for a view in PostgreSQL?
问题描述
是否有一种简单的方法可以查看用于使用 PostgreSQL 命令行客户端创建视图的代码?
Is there an easy way to see the code used to create a view using the PostgreSQL command-line client?
类似于 MySQL 的 SHOW CREATE VIEW
.
Something like the SHOW CREATE VIEW
from MySQL.
推荐答案
一直不得不返回这里查找 pg_get_viewdef
(如何记住那个!!),所以搜索了一个更容易记住的命令... 明白了:
Kept having to return here to look up pg_get_viewdef
(how to remember that!!), so searched for a more memorable command... and got it:
d+ viewname
您可以通过在 pgsql 命令行输入 ?
来查看类似的命令.
You can see similar sorts of commands by typing ?
at the pgsql command line.
额外提示:emacs 命令 sql-postgres
使 pgsql 更加愉快(编辑、复制、粘贴、命令历史).
Bonus tip: The emacs command sql-postgres
makes pgsql a lot more pleasant (edit, copy, paste, command history).
这篇关于如何在 PostgreSQL 中查看视图的 CREATE VIEW 代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!