Обсуждение: RE: what is the equivalent of oracle's DESCRIBE table?
\dt <table name> only seems to list Owner, Relation, and Type. i am looking for something that returns the same info that is found in a CREATE TABLE statement...column names, data types, etc. i haven't seen anything like this in the documentation... thanks chris -----Original Message----- From: Len Morgan [mailto:len-morgan@crcom.net] Sent: Friday, September 15, 2000 9:48 AM To: cmarkiew@commnav.com Subject: Re: [GENERAL] what is the equivalent of oracle's DESCRIBE table? in psql: \dt <table name> -----Original Message----- From: chris markiewicz <cmarkiew@commnav.com> To: 'PostgreSQL General' <pgsql-general@postgresql.org> Date: Friday, September 15, 2000 8:51 AM Subject: [GENERAL] what is the equivalent of oracle's DESCRIBE table? >hello. > >what is the postgres equivalent of oracle's command-line DESCRIBE <table> >command? does there exist a sql92 command for this? > >thank you >chris > >
How about \d <table name> I think that is the type of info oracle spits out for describe (sorry... been 6 months since I touched oracle and it was for only about 4 months that I did. :) ) Adam Lang Systems Engineer Rutgers Casualty Insurance Company ----- Original Message ----- From: "chris markiewicz" <cmarkiew@commnav.com> To: "'Len Morgan'" <len-morgan@crcom.net> Cc: "'PostgreSQL General' (E-mail)" <pgsql-general@postgresql.org> Sent: Friday, September 15, 2000 10:07 AM Subject: RE: [GENERAL] what is the equivalent of oracle's DESCRIBE table? > \dt <table name> only seems to list Owner, Relation, and Type. > > i am looking for something that returns the same info that is found in a > CREATE TABLE statement...column names, data types, etc. i haven't seen > anything like this in the documentation... > > thanks > chris > > -----Original Message----- > From: Len Morgan [mailto:len-morgan@crcom.net] > Sent: Friday, September 15, 2000 9:48 AM > To: cmarkiew@commnav.com > Subject: Re: [GENERAL] what is the equivalent of oracle's DESCRIBE > table? > > > in psql: \dt <table name> > > -----Original Message----- > From: chris markiewicz <cmarkiew@commnav.com> > To: 'PostgreSQL General' <pgsql-general@postgresql.org> > Date: Friday, September 15, 2000 8:51 AM > Subject: [GENERAL] what is the equivalent of oracle's DESCRIBE table? > > > >hello. > > > >what is the postgres equivalent of oracle's command-line DESCRIBE <table> > >command? does there exist a sql92 command for this? > > > >thank you > >chris > > > >
chris markiewicz wrote: > > \dt <table name> only seems to list Owner, Relation, and Type. > > i am looking for something that returns the same info that is found in a > CREATE TABLE statement...column names, data types, etc. i haven't seen > anything like this in the documentation... Check Chapter 37. Extending SQL: An Overview. This includes a section on the PostgreSQL system catalogs. It's rather dense, but might get you going. This subject comes up now and again, so I'm sure there's also some info in the list archives. This section also says "The Reference Manual gives a more detailed explanation of these catalogs and their attributes." Where can one find this Reference Manual? -- Ron Peterson Systems Manager Wallace Floyd Design Group 273 Summer Street Boston, MA 02210 617.350.7400 tel 617.350.0051 fax rpeterson@wallacefloyd.com
use \d <tablename>
postgres@davis ~> psql demogdata
Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
[PostgreSQL 6.5.0 on sparc-sun-solaris2.6, compiled by /usr/local/bin/gcc
]
type \? for help on slash commands
type \q to quit
type \g or terminate with semicolon to execute query
You are currently connected to the database: demogdata
demogdata=> \d event_detail
Table = event_detail
+----------------------------------+----------------------------------+-------+
| Field | Type |
Length|
+----------------------------------+----------------------------------+-------+
| event_id | int4 not null default nextval('" |
4 |
| dt1eventid | int2 |
2 |
| eventtypeid | int4 |
4 |
| id | int4 |
4 |
| date_effective | datetime |
8 |
| date_expires | datetime |
8 |
| expected | bool |
1 |
| title | varchar() |
150 |
| sourceid | int4 |
4 |
| cost | float8 |
8 |
| spec1 | varchar() |
50 |
| spec2 | varchar() |
50 |
| spec3 | varchar() |
50 |
| spec4 | varchar() |
50 |
| spec5 | varchar() |
50 |
| spec6 | varchar() |
50 |
| spec7 | varchar() |
50 |
| spec8 | varchar() |
50 |
| comments | text |
var |
| current_interests | text |
var |
| updated | varchar() |
25 |
| override | varchar() |
25 |
| semester | varchar() |
15 |
| acadyear | varchar() |
12 |
| chair | int4 |
4 |
| member1 | int4 |
4 |
| member2 | int4 |
4 |
| degree | varchar() |
5 |
+----------------------------------+----------------------------------+-------+
Indices: date_effective_idx
etid_detail_idx
event_detail_event_id_key
---------------------------------------------------------------------
Andrew J. Perrin - aperrin@demog.berkeley.edu - NT/Unix Admin/Support
Department of Demography - University of California at Berkeley
2232 Piedmont Avenue #2120 - Berkeley, California, 94720-2120 USA
http://demog.berkeley.edu/~aperrin --------------------------SEIU1199
On Fri, 15 Sep 2000, chris markiewicz wrote:
> \dt <table name> only seems to list Owner, Relation, and Type.
>
> i am looking for something that returns the same info that is found in a
> CREATE TABLE statement...column names, data types, etc. i haven't seen
> anything like this in the documentation...
>
> thanks
> chris
>
> -----Original Message-----
> From: Len Morgan [mailto:len-morgan@crcom.net]
> Sent: Friday, September 15, 2000 9:48 AM
> To: cmarkiew@commnav.com
> Subject: Re: [GENERAL] what is the equivalent of oracle's DESCRIBE
> table?
>
>
> in psql: \dt <table name>
>
> -----Original Message-----
> From: chris markiewicz <cmarkiew@commnav.com>
> To: 'PostgreSQL General' <pgsql-general@postgresql.org>
> Date: Friday, September 15, 2000 8:51 AM
> Subject: [GENERAL] what is the equivalent of oracle's DESCRIBE table?
>
>
> >hello.
> >
> >what is the postgres equivalent of oracle's command-line DESCRIBE <table>
> >command? does there exist a sql92 command for this?
> >
> >thank you
> >chris
> >
> >
>