如何在 PostgreSQL 中查看视图的 CREATE VIEW 代码? [英] How to see the CREATE VIEW code for a view in PostgreSQL?

查看:31
本文介绍了如何在 PostgreSQL 中查看视图的 CREATE VIEW 代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法可以查看用于使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆