Re: dictionary?

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Ray Stell <stellr(at)cns(dot)vt(dot)edu>, Novice Postgresql-list <pgsql-novice(at)postgresql(dot)org>
Subject: Re: dictionary?
Date: 2006-09-22 19:42:31
Message-ID: 20060922194231.70021.qmail@web31801.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

>
> great, how about the other half, finding the table of interest?
>
>
>
> On Fri, Sep 22, 2006 at 12:28:50PM -0700, Richard Broersma Jr wrote:
> > > How do you accomplish this in pg?
> > >
> > > 1. Is there a table like the Oracle dictionary?
> > > 2. Is there a way to describe a table?
> > >
> > > I use these all the time in oracle. When I can't remember where
> > > some management metric is located in the system, I sort of grep for
> > > it based on a keyword. For example, if I need to find out about some
> > > snapshot (copy of a table from another db), I do this:
> > >
> > >
> > > select table_name from dictionary where table_name like '%SNAPSHOT%';
> > >
> > > TABLE_NAME
> > > ------------------------------
> > > ALL_REGISTERED_SNAPSHOTS
> > > ALL_SNAPSHOTS
> > > ...
> > >
> > >
> > > SQL> describe ALL_SNAPSHOTS
> > > Name Null? Type
> > > ----------------------------------------- -------- ----------------------------
> > > OWNER NOT NULL VARCHAR2(30)
> > > NAME NOT NULL VARCHAR2(30)
> > > TABLE_NAME NOT NULL VARCHAR2(30)
> > > ...
> > >
> > >
> > > select name from ALL_SNAPSHOTS;
> > > ...
> >
> >
> > How about:
> >
> > \d tablename
> > \dt tablename
> >
> > For more information check out the "Meta-Commands" from:
> > http://www.postgresql.org/docs/8.1/interactive/app-psql.html
> >
> > Regards,
> >
> > Richard Broersma Jr.
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
>
> --
>
Don't forget to CC the list so that everyone can reply.

Here is the verbage from the PostgreSQL manual: ( pattern can be a Regular Expression )
Notice \d, it will display most everything. Is this what you were looking for?

\d [ pattern ]
\d+ [ pattern ]
For each relation (table, view, index, or sequence) matching the pattern, show all columns, their
types, the tablespace (if not the default) and any special attributes such as NOT NULL or
defaults, if any. Associated indexes, constraints, rules, and triggers are also shown, as is the
view definition if the relation is a view. ("Matching the pattern" is defined below.)

The command form \d+ is identical, except that more information is displayed: any comments
associated with the columns of the table are shown, as is the presence of OIDs in the table.

Note: If \d is used without a pattern argument, it is equivalent to \dtvs which will show a list
of all tables, views, and sequences. This is purely a convenience measure.

Browse pgsql-novice by date

  From Date Subject
Next Message Ray Stell 2006-09-22 19:49:29 Re: dictionary?
Previous Message Tomeh, Husam 2006-09-22 19:40:35 Re: dictionary?