Re: Modifying pg_shadow?

From: Oliver Fromme <olli(at)lurza(dot)secnetix(dot)de>
To: jhihn(at)paytimepayroll(dot)com (Jason Hihn)
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Modifying pg_shadow?
Date: 2003-09-09 15:55:06
Message-ID: 200309091555.h89Ft6SO042457@lurza.secnetix.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


Jason Hihn wrote:
> "Chapter 9. Backup and Restore":
> pg_dump dbname > outfile

That'll backup a complete database.

> What's the dbname for the system tables?

There is none. The system tables are always visible, no
matter which DB you're connected to. That's why they are
system tables ...

> The -g option of pg_dumpall only
> does users and groups. No other tables. (Eek!)

What other information do you need to be dumped? Users and
groups are the _only_ global (i.e. cluster-wide) objects,
as far as I have learned. Everything else is related to a
specific database, so it will be dumped along with that
database when you use pg_dump.

> Ah, wonderful. This is what I was looking for. Though in the past I've used
> databases where I wouldn't have to parse this text. It was quite easy and
> fun to work with as tuple data. *wink*

In my opinion it shouldn't be visible at all, because it
encourages all kinds of abuse ...

> Ok, so I have a question If I have 2 databases, a and b, and they both have
> a table, c, how do I grant permissions only to table a.t and not both tables
> in both databases at the same time? The intituve answer is not correct -
> that 'ON a.t ...' does not work.

You're always connected to one database. A GRANT command
will affect only that database, nothing else. Even when
you issue GRANT on system tables (which are visible in
every database), the change will only affect the database
you're connected to. I learned that a few days ago, thanks
to Tom Lane. :-)

> > However, in your case, it might be beneficial to store the
> > data about users in your own database, in a format which is
> > suitable for your use. You can then generate grant/revoke
> > commands from that if necessary. It would also be a lot
> > more portable than depending on the internal structure of
> > PG system tables.
>
> I really don't want to have to re-invent the wheel here.

Well, if you prefer to use ready-made wheels which are
square instead of round ... ;-)

Regards
Oliver

PS: I'm still a novice, too, so if I talk nonsense, please
someone correct me. :-)

--
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"A language that doesn't have everything is actually easier
to program in than some that do."
-- Dennis M. Ritchie

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Jason Hihn 2003-09-09 16:09:24 Re: Modifying pg_shadow?
Previous Message Tom Lane 2003-09-09 15:30:18 Re: Modifying pg_shadow?