Thread: Is there a PostgresQL equivalent to the DESCRIBE keyword???
Hey All, I'm trying to display the schema to various tables. In most other databases, you can use the DESCRIBE keyword or the SHOW keyword (I believe this is a SQL99 keyword). Is there an equivalent in PostgresQL? Also, does PostgresQL have an equivalent to the following: SHOW CREATE TABLE table_name Thanks for any help. Peter
while in psql type: \d tablename (don't add a semicolon) On Fri, 14 Dec 2001, Peter E. Chen wrote: > Hey All, > > I'm trying to display the schema to various tables. In most other > databases, you can use the DESCRIBE keyword or the SHOW keyword (I believe > this is a SQL99 keyword). Is there an equivalent in PostgresQL? > > Also, does PostgresQL have an equivalent to the following: > > SHOW CREATE TABLE table_name > > Thanks for any help. > > Peter > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html >
In psql, enter \d [table name]. Best of luck, Andrew Gould --- "Peter E. Chen" <pchen3@jhmi.edu> wrote: > Hey All, > > I'm trying to display the schema to various tables. > In most other > databases, you can use the DESCRIBE keyword or the > SHOW keyword (I believe > this is a SQL99 keyword). Is there an equivalent in > PostgresQL? > > Also, does PostgresQL have an equivalent to the > following: > > SHOW CREATE TABLE table_name > > Thanks for any help. > > Peter > > > ---------------------------(end of > broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com
If you want to see the SQL that psql uses to do this, \set ECHO_HIDDEN or start psql with the -E option. On Fri, 2001-12-14 at 19:09, Andrew Gould wrote: > In psql, enter \d [table name]. > > Best of luck, > > Andrew Gould > > --- "Peter E. Chen" <pchen3@jhmi.edu> wrote: > > Hey All, > > > > I'm trying to display the schema to various tables. > > In most other > > databases, you can use the DESCRIBE keyword or the > > SHOW keyword (I believe > > this is a SQL99 keyword). Is there an equivalent in > > PostgresQL? > > > > Also, does PostgresQL have an equivalent to the > > following: > > > > SHOW CREATE TABLE table_name > > > > Thanks for any help. > > > > Peter > > > > > > ---------------------------(end of > > broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > > __________________________________________________ > Do You Yahoo!? > Check out Yahoo! Shopping and Yahoo! Auctions for all of > your unique holiday gifts! Buy at http://shopping.yahoo.com > or bid at http://auctions.yahoo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) -- Andrew G. Hammond mailto:drew@xyzzy.dhs.org http://xyzzy.dhs.org/~drew/ 56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F 613-389-5481 5CD3 62B0 254B DEB1 86E0 8959 093E F70A B457 84B1 "To blow recursion you must first blow recur" -- me