相当于“描述表"在 PgAdmin3 [英] Equivalent of "describe table" in PgAdmin3

查看:14
本文介绍了相当于“描述表"在 PgAdmin3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题的提出和回答:

众所周知,PostgreSQL 不支持 describe tabledescribe view.正如人们可能从谷歌发现的那样,PostgreSQL 使用 d+ 代替.

As many of us know, PostgreSQL does not support describe table or describe view. As one might find from google, PostgreSQL uses d+ instead.

但是,如果使用 PgAdmin 访问 PostgreSQL(我实际上使用的是 PgAdmin3),则 d+ 不起作用.一个人会做什么?

However, if one accesses PostgreSQL using PgAdmin (I am actually using PgAdmin3) then d+ does not work. What does one do instead?

我在玩PgAdmin3中的查询工具时想到了这个问题.我有一个好吧,呃!"当我想到查看 PgAdmin3 的主窗口以及该窗口左侧的树的那一刻.在

I thought about this question when playing with the query tool in PgAdmin3. I had a "well, duh!" moment when I thought to look at the home window of PgAdmin3, and at the tree on the left side of that window. Under

<servername>
-> <databasename>
-> Schemas
-> <schemaname>
-> Tables

是我的表的列表,并点击表名显示我的文字非常像 d+ 会向我展示的内容.

was a list of my tables, and clicking on the table name showed me text very much like what d+ would have showed me.

因此,为了其他没有立即发现这一点的人的利益,这里是一个答案.

So for the benefit of anyone else who did not discover this right away, here is an answer.

推荐答案

PostgreSQL 还支持标准的 SQL 信息模式来检索数据库中对象的详细信息.

PostgreSQL also supports the standard SQL information schema to retrieve details of objects in the database.

即要获取列信息,您可以查询 information_schema.columns 视图:

i.e. to get column information you can query the information_schema.columns view:

SELECT *
FROM information_schema.columns
WHERE table_name = '<YourTableName>';

一定要用单引号,双引号不行

此处查看有关 PostgreSQL 信息的特定详细信息模式.

Check here for PostgreSQL specific details on the information schema.

这篇关于相当于“描述表"在 PgAdmin3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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