pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
get table schema in psql?
6+ messages / 5 participants
[nested] [flat]

* get table schema in psql?
@ 2000-09-15 08:47 Michael Teter <michael_teter@yahoo.com>
  2000-09-15 09:42 ` Re: get table schema in psql? Patrik Kudo <kudo@partitur.se>
  2000-09-15 12:29 ` Re: get table schema in psql? Rommel B. Abaya <rommel.abaya@ramcargroup.com>
  2000-09-15 21:29 ` Re: get table schema in psql? Jie Liang <jliang@ipinc.com>
  0 siblings, 3 replies; 6+ messages in thread

From: Michael Teter @ 2000-09-15 08:47 UTC (permalink / raw)
  To: pgsql-sql@hub.org

how can I get the schema of a table in psql?

in oracle I would do "desc tablename".  I remember sql
server and ingres having a similar facility.

right now the only way I seem to be able to get the
information is by using pgaccess.

I realize the definition of the table is probably
spread across the various pg_ system tables, but I'm
thinking there must be some easier way to get the
info.

in particular, I'm after the list of columns, their
data types and lengths, null/non-null, default values,
and table indices.

thanks,
michael

__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: get table schema in psql?
  2000-09-15 08:47 get table schema in psql? Michael Teter <michael_teter@yahoo.com>
@ 2000-09-15 09:42 ` Patrik Kudo <kudo@partitur.se>
  2 siblings, 0 replies; 6+ messages in thread

From: Patrik Kudo @ 2000-09-15 09:42 UTC (permalink / raw)
  To: Michael Teter <michael_teter@yahoo.com>; +Cc: pgsql-sql@hub.org

Hi!

I think what you're looking for is

\d

and

\d name_of_table

You might also want to try

\?

for a list of all psql commands

Regards,
Patrik Kudo

ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
Känns det oklart? Fråga på!

On Fri, 15 Sep 2000, Michael Teter wrote:

> how can I get the schema of a table in psql?
> 
> in oracle I would do "desc tablename".  I remember sql
> server and ingres having a similar facility.
> 
> right now the only way I seem to be able to get the
> information is by using pgaccess.
> 
> I realize the definition of the table is probably
> spread across the various pg_ system tables, but I'm
> thinking there must be some easier way to get the
> info.
> 
> in particular, I'm after the list of columns, their
> data types and lengths, null/non-null, default values,
> and table indices.
> 
> thanks,
> michael
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
> 




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: get table schema in psql?
  2000-09-15 08:47 get table schema in psql? Michael Teter <michael_teter@yahoo.com>
@ 2000-09-15 12:29 ` Rommel B. Abaya <rommel.abaya@ramcargroup.com>
  2000-09-15 23:53   ` Re: get table schema in psql? Roderick A. Anderson <raanders@altoplanos.net>
  2 siblings, 1 reply; 6+ messages in thread

From: Rommel B. Abaya @ 2000-09-15 12:29 UTC (permalink / raw)
  To: Michael Teter <michael_teter@yahoo.com>; +Cc: pgsql-sql@hub.org

type \d [tablename] at the psql console



Michael Teter wrote:

> how can I get the schema of a table in psql?
>
> in oracle I would do "desc tablename".  I remember sql
> server and ingres having a similar facility.
>
> right now the only way I seem to be able to get the
> information is by using pgaccess.
>
> I realize the definition of the table is probably
> spread across the various pg_ system tables, but I'm
> thinking there must be some easier way to get the
> info.
>
> in particular, I'm after the list of columns, their
> data types and lengths, null/non-null, default values,
> and table indices.
>
> thanks,
> michael
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: get table schema in psql?
  2000-09-15 08:47 get table schema in psql? Michael Teter <michael_teter@yahoo.com>
  2000-09-15 12:29 ` Re: get table schema in psql? Rommel B. Abaya <rommel.abaya@ramcargroup.com>
@ 2000-09-15 23:53   ` Roderick A. Anderson <raanders@altoplanos.net>
  0 siblings, 0 replies; 6+ messages in thread

From: Roderick A. Anderson @ 2000-09-15 23:53 UTC (permalink / raw)
  To: pgsql-sql@hub.org

On Fri, 15 Sep 2000, Rommel B. Abaya wrote:

> type \d [tablename] at the psql console

And if you like that try:

\d+ [tablename]

Of course it's much more impressive if you've created any COMMENTs.


Rod
--
Roderick A. Anderson
raanders@altoplanos.net               Altoplanos Information Systems, Inc.
Voice: 208.765.6149                            212 S. 11th Street, Suite 5
FAX: 208.664.5299                                  Coeur d'Alene, ID 83814




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: get table schema in psql?
  2000-09-15 08:47 get table schema in psql? Michael Teter <michael_teter@yahoo.com>
@ 2000-09-15 21:29 ` Jie Liang <jliang@ipinc.com>
  2 siblings, 0 replies; 6+ messages in thread

From: Jie Liang @ 2000-09-15 21:29 UTC (permalink / raw)
  To: Michael Teter <michael_teter@yahoo.com>; +Cc: pgsql-sql@hub.org

Hi, there,

You just need type

psql> \d tablename
use
\? to get help

Michael Teter wrote:

> how can I get the schema of a table in psql?
>
> in oracle I would do "desc tablename".  I remember sql
> server and ingres having a similar facility.
>
> right now the only way I seem to be able to get the
> information is by using pgaccess.
>
> I realize the definition of the table is probably
> spread across the various pg_ system tables, but I'm
> thinking there must be some easier way to get the
> info.
>
> in particular, I'm after the list of columns, their
> data types and lengths, null/non-null, default values,
> and table indices.
>
> thanks,
> michael
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/

--
Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com






^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: get table schema in psql?
@ 2000-09-15 09:49 Michael Teter <michael_teter@yahoo.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Teter @ 2000-09-15 09:49 UTC (permalink / raw)
  To: Patrik Kudo <kudo@partitur.se>; +Cc: pgsql-sql@hub.org

doh!

thanks so much.  somehow I thought \h and \? were the
same, and I've only been doing \h :)

no wonder I couldn't find it.

michael

--- Patrik Kudo <kudo@partitur.se> wrote:
> Hi!
> 
> I think what you're looking for is
> 
> \d
> 
> and
> 
> \d name_of_table
> 
> You might also want to try
> 
> \?
> 
> for a list of all psql commands
> 
> Regards,
> Patrik Kudo
> 
> ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo
> un\2\1 is xg'`ol
> Känns det oklart? Fråga på!
> 
> On Fri, 15 Sep 2000, Michael Teter wrote:
> 
> > how can I get the schema of a table in psql?
> > 
> > in oracle I would do "desc tablename".  I remember
> sql
> > server and ingres having a similar facility.
> > 
> > right now the only way I seem to be able to get
> the
> > information is by using pgaccess.
> > 
> > I realize the definition of the table is probably
> > spread across the various pg_ system tables, but
> I'm
> > thinking there must be some easier way to get the
> > info.
> > 
> > in particular, I'm after the list of columns,
> their
> > data types and lengths, null/non-null, default
> values,
> > and table indices.
> > 
> > thanks,
> > michael
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Mail - Free email you can access from
> anywhere!
> > http://mail.yahoo.com/
> > 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2000-09-15 23:53 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-09-15 08:47 get table schema in psql? Michael Teter <michael_teter@yahoo.com>
2000-09-15 09:42 ` Patrik Kudo <kudo@partitur.se>
2000-09-15 12:29 ` Rommel B. Abaya <rommel.abaya@ramcargroup.com>
2000-09-15 23:53   ` Roderick A. Anderson <raanders@altoplanos.net>
2000-09-15 21:29 ` Jie Liang <jliang@ipinc.com>
2000-09-15 09:49 Re: get table schema in psql? Michael Teter <michael_teter@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox