Thread: Migration from MySQL, some difficulties with DESCRIBE and SHOW
I just migrated to PostgreSQL since this offers a few features I needes ugently, especially subqueries. However I got to stuck with DESCRIBE and SHOW commands. Are those not avaliable, or have they some special behaviour? When trying a SHOW TABLES; I just get an error. Wolfgang --
Try: \d tablename for DESCRIBE functionality \dt for SHOW TABLES functionality. Hope that helps, Eric ----- Original Message ----- From: "Wolfgang Draxinger" <wdraxinger@darkstargames.de> To: <pgsql-novice@postgresql.org> Sent: Sunday, August 03, 2003 2:44 PM Subject: [NOVICE] Migration from MySQL, some difficulties with DESCRIBE and SHOW > I just migrated to PostgreSQL since this offers a few features I needes > ugently, especially subqueries. However I got to stuck with DESCRIBE and > SHOW commands. Are those not avaliable, or have they some special behaviour? > When trying a SHOW TABLES; I just get an error. > > Wolfgang > -- > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend >
Date sent: Sun, 03 Aug 2003 21:44:04 +0200 From: Wolfgang Draxinger <wdraxinger@darkstargames.de> To: pgsql-novice@postgresql.org Subject: [NOVICE] Migration from MySQL, some difficulties with DESCRIBE and SHOW I'm unfamiliar with mysql, but I think what you are looking for in the psql client are these commands SHOW TABLES: \d{t|i|s|v}... list tables/indexes/sequences/views \d will give a list of all of these objects \dt will give a list of only tables mfx=# \d List of relations Name | Type | Owner ------------------+----------+--------------- accent | table | Administrator accenttype | table | Administrator actor | table | Administrator actor_id_seq | sequence | Administrator actoraudio | view | Administrator audio | table | Administrator audiotype | table | Administrator (7 rows) DESCRIBE: (I'm assuming this gives a listing of a table's structure) \d tablename mfx=# \d accent Table "accent" Column | Type | Modifiers ------------+-------------------+----------- accenttype | character varying | not null id | integer | not null Primary key: accent_pkey Triggers: RI_ConstraintTrigger_1673596, RI_ConstraintTrigger_1673602 Hope this helps Paul Butler > I just migrated to PostgreSQL since this offers a few features I needes > ugently, especially subqueries. However I got to stuck with DESCRIBE and > SHOW commands. Are those not avaliable, or have they some special behaviour? > When trying a SHOW TABLES; I just get an error. > > Wolfgang > -- > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend
On Sun, 3 Aug 2003, Wolfgang Draxinger wrote: > I just migrated to PostgreSQL since this offers a few features I needes > ugently, especially subqueries. However I got to stuck with DESCRIBE and > SHOW commands. As others mentioned you want to check the '\d' commands. Do a \? and \help so you see some usefull online help. In particular there is a syntax description of every command when you use \help ie. \help alter table Also search the web for "Practical PostgreSQL". I believe that book is available online. Also check the online docs at http://www.postgresql.org/docs/