Обсуждение: Looking for a command to list schemas

Поиск
Список
Период
Сортировка

Looking for a command to list schemas

От
"Cosmopo"
Дата:
Hello,

We are presently experimenting with Postgresql schemas... We used basic
commands like \d  to list info from all tables/sequence/owner in a
db... The schema info was always "public" since we never created one...

In version 7.3.4 and with a test db where schemas were created, the
same \d does not show the schema of each table... the \dp  doesn't help
width the privileges...

It seems that once we created the schema and created a table with this
schema, if we forget about it, the is no way to list the schema or to
have the tables/sequence with it's associated schema...

Can someone tell us how we can get this important info?
Thanks!
--
Mark


Re: Looking for a command to list schemas

От
Andreas Kretschmer
Дата:
Cosmopo <tempo@marquo.com> schrieb:
> It seems that once we created the schema and created a table with this
> schema, if we forget about it, the is no way to list the schema or to
> have the tables/sequence with it's associated schema...
>
> Can someone tell us how we can get this important info?

\dn in psql list all schemas.


HTH, Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

Re: Looking for a command to list schemas

От
Martijn van Oosterhout
Дата:
On Tue, Oct 25, 2005 at 11:25:22AM -0700, Cosmopo wrote:
> Hello,
>
> We are presently experimenting with Postgresql schemas... We used basic
> commands like \d  to list info from all tables/sequence/owner in a
> db... The schema info was always "public" since we never created one...

\dn   list schemas
\dt *.*  list all tables in all schemas
\z *.*   list priveledges for all tables in all schemas
etc...

Is this helpful?
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

Re: Looking for a command to list schemas

От
Michael Fuhr
Дата:
On Wed, Oct 26, 2005 at 03:35:31PM +0200, Andreas Kretschmer wrote:
> Cosmopo <tempo@marquo.com> schrieb:
> > It seems that once we created the schema and created a table with this
> > schema, if we forget about it, the is no way to list the schema or to
> > have the tables/sequence with it's associated schema...
> >
> > Can someone tell us how we can get this important info?
>
> \dn in psql list all schemas.

The poster mentioned 7.3.4 -- that version's psql didn't have \dn,
so using it results in the following error:

test=> \dn
Did not find any relation named "n".

You can get the list of schemas by querying the system catalogs:

SELECT * FROM pg_namespace;

--
Michael Fuhr

Re: Looking for a command to list schemas

От
Marc Andre Paquin
Дата:
Le 2005 10 26 09:36, Martijn van Oosterhout a ecrit:
> On Tue, Oct 25, 2005 at 11:25:22AM -0700, Cosmopo wrote:
> > Hello,
> >
> > We are presently experimenting with Postgresql schemas... We used basic
> > commands like \d  to list info from all tables/sequence/owner in a
> > db... The schema info was always "public" since we never created one...
>
> \dn   list schemas
> \dt *.*  list all tables in all schemas
> \z *.*   list priveledges for all tables in all schemas
> etc...
>
> Is this helpful?

Hello,

Yes and no... The \dn  does not list the schemas... I thinks it's my old
Postgresql version (7.3.2 and 7.3.4)...  But  \z  does the trick...

It's a sign that it's time to upgrade...  8-)
Thanks
--
Mark
~~~~~~~~~~~~~~