Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of "describe table" in PgAdmin3

Tags:

Question asked and answered:

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

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

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 

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.

like image 705
user3112568 Avatar asked Jan 29 '14 20:01

user3112568


People also ask

How do you DESC a table in PostgreSQL?

PostgreSQL describe table is defined as check the structure of table, we can describe the structure of table by using \d and table name command in PostgreSQL. In PostgreSQL describe table statement is not present like MySQL instead of describe we have using \d table name and \d+ table name.

How do you describe a table in pgadmin4?

In pgAdmin 4, we are going to use the information_schema for describing the tables. Here, the information schema itself is a schema that is automatically present in all databases and called information_schema. And by default, it is not available in the schema search path.

How do you create a table in pgadmin3?

Now reach "tables" in pgAdmin III window, right click on "tables" and click on "New Table". This will open a new window to create a New Table. Supply a name of your new table and then click on Columns.


1 Answers

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

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

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

Be sure to use single quotations, double quotes won't work

Check here for PostgreSQL specific details on the information schema.

like image 138
Gareth Flowers Avatar answered Oct 25 '22 07:10

Gareth Flowers