Table description
Hi.
Is there any command that describe a table, such as desc table_name as in
Oracle?
Thanks in advance.
--
Lívia Silva Santos
--- Livia Santos <liviasilvasantos@gmail.com> wrote:
Is there any command that describe a table, such as desc table_name as in
Oracle?
from the psql user interface, you can use the following command:
\dt
to list all table in the currently set schema
\d [table_name]
the see the table attributes
\d+ [table_name]
to see additional table attributes
Regards,
Richard Broersma Jr.
On 8/20/07, Livia Santos <liviasilvasantos@gmail.com> wrote:
Hi.
Is there any command that describe a table, such as desc table_name as in
Oracle?
Yes and no. The psql client has a series of \ commands that can
describe pretty much anything in the db in a pretty print nature and a
minimum of typing. The \ commands are NOT implemented in the backend,
but in the psql client so you can't just hit the db with \d from a
libpq connection to get a list of all tables / views / sequences.
However, you can use psql -E to have psql show you al lthe queries
it's throwing at the backend to get that pretty output, and then you
can take what it's doing and either wrap it in a view for future use,
or run it directly.
Livia Santos wrote:
Hi.
Is there any command that describe a table, such as desc table_name as
in Oracle?
Not sure how desc table_name works in Oracle, but from psql you can use:
\dt table_name
Issue \? in psql for more information.
Regards,
roppert
Show quoted text
Thanks in advance.
--
Lívia Silva Santos
Thanks a lot, guys.
\d <table_name> is exactly what I needed!
On 8/20/07, Robert Gravsjö <robert@blogg.se> wrote:
Livia Santos wrote:
Hi.
Is there any command that describe a table, such as desc table_name as
in Oracle?Not sure how desc table_name works in Oracle, but from psql you can use:
\dt table_nameIssue \? in psql for more information.
Regards,
roppertThanks in advance.
--
Lívia Silva Santos
--
Lívia Silva Santos
Unicamp/Ceset TI02