pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedPermissons on database
6+ messages / 6 participants
[nested] [flat]
* Permissons on database
@ 2001-03-06 17:00 Boulat Khakimov <boulat@inet-interactif.com>
2001-03-06 17:09 ` Re: [SQL] Permissons on database Oliver Elphick <olly@lfix.co.uk>
2001-03-06 17:26 ` Re: [SQL] Permissons on database dev@archonet.com
2001-03-07 20:40 ` Re: [SQL] Permissons on database Roland Roberts <roland@astrofoto.org>
0 siblings, 3 replies; 6+ messages in thread
From: Boulat Khakimov @ 2001-03-06 17:00 UTC (permalink / raw)
To: pgsql-sql; pgsql-general@postgresql.org; pgsql-novice@postgresql.org
Hi,
How do I grant permissions on everything in the selected databes?
GRANT doesnt take as on object database name nor does it accept wild
chars....
--
Nothing Like the Sun
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] Permissons on database
2001-03-06 17:00 Permissons on database Boulat Khakimov <boulat@inet-interactif.com>
@ 2001-03-06 17:09 ` Oliver Elphick <olly@lfix.co.uk>
2 siblings, 0 replies; 6+ messages in thread
From: Oliver Elphick @ 2001-03-06 17:09 UTC (permalink / raw)
To: Boulat Khakimov <boulat@inet-interactif.com>; +Cc: pgsql-sql; pgsql-general@postgresql.org; pgsql-novice@postgresql.org
Boulat Khakimov wrote:
>Hi,
>
>How do I grant permissions on everything in the selected databes?
>
>GRANT doesnt take as on object database name nor does it accept wild
>chars....
However you can give it a list of tables (and other objects).
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"The LORD is my light and my salvation; whom shall I
fear? the LORD is the strength of my life; of whom
shall I be afraid?" Psalms 27:1
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] Permissons on database
2001-03-06 17:00 Permissons on database Boulat Khakimov <boulat@inet-interactif.com>
@ 2001-03-06 17:26 ` dev@archonet.com
2 siblings, 0 replies; 6+ messages in thread
From: dev@archonet.com @ 2001-03-06 17:26 UTC (permalink / raw)
To: Boulat Khakimov <boulat@inet-interactif.com>; +Cc: pgsql-sql; pgsql-general@postgresql.org; pgsql-novice@postgresql.org
On 3/6/01, 5:00:47 PM, Boulat Khakimov <boulat@inet-interactif.com> wrote
regarding [SQL] Permissons on database:
> Hi,
> How do I grant permissions on everything in the selected databes?
> GRANT doesnt take as on object database name nor does it accept wild
> chars....
By hand at the moment I'm afraid. There is no GRANT ALL ON ALL...
Having said that, if you have plpgsql enabled on that database you could
write a simple loop to do so for you. If you'd find one useful let me
know and I'll knock one up.
- Richard Huxton
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] Permissons on database
2001-03-06 17:00 Permissons on database Boulat Khakimov <boulat@inet-interactif.com>
@ 2001-03-07 20:40 ` Roland Roberts <roland@astrofoto.org>
2001-03-13 02:20 ` Re: [SQL] Permissons on database Rob Arnold <rob@cabrion.com>
2001-04-08 09:10 ` Re: [GENERAL] Re: Permissons on database Louis-David Mitterrand <vindex@apartia.ch>
2 siblings, 2 replies; 6+ messages in thread
From: Roland Roberts @ 2001-03-07 20:40 UTC (permalink / raw)
To: pgsql-sql; pgsql-general@postgresql.org; pgsql-novice@postgresql.org
bk> How do I grant permissions on everything in the selected
bk> databes?
bk> GRANT doesnt take as on object database name nor does it
bk> accept wild chars....
Attached is some Perl code I wrote long ago to do this. This
particular code was done for Keystone, a problem tracking database and
it would do a "GRANT ALL". Modify it as needed. Last I checked it
worked with both PostgreSQL 6.5.x and 7.0.x
roland
--
PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
roland@rlenter.com 76-15 113th Street, Apt 3B
rbroberts@acm.org Forest Hills, NY 11375
Attachments:
pg_grantall.pl (text/plain, 1.2K) download
#! /usr/bin/perl -w
# I'm also appending a Perl script to grant public access to all
# keystone tables. It uses the Pg module for PostgreSQL, so you will
# need to add that first. However, I find it a bit less tedious than
# granting access by hand....
# Roland B. Roberts, PhD Custom Software Solutions
# roberts@panix.com 101 West 15th St #4NN
# rbroberts@acm.org New York, NY 10011
use Pg;
if (defined $ARGV[0]) {
$dbname = $ARGV[0];
} else {
$dbname = "keystone";
}
print "connecting to $dbname\n";
$dbh = Pg::connectdb("dbname=$dbname $ARGV[1]");
die "Pg::connectdb failed, $dbh->errorMessage"
unless ($dbh->status == PGRES_CONNECTION_OK);
$c{relname} = $dbh->exec ("select relname from pg_class where relname !~ '^pg_' and relkind != 'i'");
die "Pg::exec, $dbh->errorMessage"
unless ($c{relname}->resultStatus == PGRES_TUPLES_OK);
for ($i = 0; $i < $c{relname}->ntuples; $i++) {
$relname = $c{relname}->getvalue($i,0);
print "grant all on $relname to public\n";
$c{grant} = $dbh->exec ("grant all on $relname to public");
die "Pg::exec, ".$dbh->errorMessage
unless ($c{grant}->resultStatus == PGRES_COMMAND_OK);
}
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] Permissons on database
2001-03-06 17:00 Permissons on database Boulat Khakimov <boulat@inet-interactif.com>
2001-03-07 20:40 ` Re: [SQL] Permissons on database Roland Roberts <roland@astrofoto.org>
@ 2001-03-13 02:20 ` Rob Arnold <rob@cabrion.com>
1 sibling, 0 replies; 6+ messages in thread
From: Rob Arnold @ 2001-03-13 02:20 UTC (permalink / raw)
To: pgsql-sql; pgsql-general@postgresql.org; pgsql-novice@postgresql.org; Roland Roberts <roland@astrofoto.org>
Are you looking for "grant all to public" or "grant select to public"?
----- Original Message -----
From: "Roland Roberts" <roland@astrofoto.org>
To: <pgsql-sql@postgresql.org>; <pgsql-general@postgresql.org>;
<pgsql-novice@postgresql.org>
Sent: Wednesday, March 07, 2001 3:40 PM
Subject: Re: [SQL] Permissons on database
> >>>>> "bk" == Boulat Khakimov <boulat@inet-interactif.com> writes:
>
> bk> How do I grant permissions on everything in the selected
> bk> databes?
>
> bk> GRANT doesnt take as on object database name nor does it
> bk> accept wild chars....
>
> Attached is some Perl code I wrote long ago to do this. This
> particular code was done for Keystone, a problem tracking database and
> it would do a "GRANT ALL". Modify it as needed. Last I checked it
> worked with both PostgreSQL 6.5.x and 7.0.x
>
>
----------------------------------------------------------------------------
----
>
> roland
> --
> PGP Key ID: 66 BC 3B CD
> Roland B. Roberts, PhD RL Enterprises
> roland@rlenter.com 76-15 113th Street, Apt 3B
> rbroberts@acm.org Forest Hills, NY 11375
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [GENERAL] Re: Permissons on database
2001-03-06 17:00 Permissons on database Boulat Khakimov <boulat@inet-interactif.com>
2001-03-07 20:40 ` Re: [SQL] Permissons on database Roland Roberts <roland@astrofoto.org>
@ 2001-04-08 09:10 ` Louis-David Mitterrand <vindex@apartia.ch>
1 sibling, 0 replies; 6+ messages in thread
From: Louis-David Mitterrand @ 2001-04-08 09:10 UTC (permalink / raw)
To: pgsql-sql
On Wed, Mar 07, 2001 at 03:40:44PM -0500, Roland Roberts wrote:
> >>>>> "bk" == Boulat Khakimov <boulat@inet-interactif.com> writes:
>
> bk> How do I grant permissions on everything in the selected
> bk> databes?
>
> bk> GRANT doesnt take as on object database name nor does it
> bk> accept wild chars....
>
> Attached is some Perl code I wrote long ago to do this. This
> particular code was done for Keystone, a problem tracking database and
> it would do a "GRANT ALL". Modify it as needed. Last I checked it
> worked with both PostgreSQL 6.5.x and 7.0.x
A simple two-line shell script to apply any command to a list of tables:
for i in `psql mydatabase -c '\dt' -P tuples_only | cut -f2 -d ' '`
do psql mydatabase -c "grant all on $i to public"; done
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
These mailing list footers really suck. Please consider removing them.
They reflect poorly on the general level of the pgsql-* lists. Instead
do send a one-time "welcome" message containing all your "tips" when
people subscribe to a list.
Probably a lost cause but the subject mangling [GENERAL], [HACKERS] etc.
(especially that one! a "hacker" should know how to filter his mail)
really sucks too.
Educate, don't stoop. Even Outlook Express has great filtering
capabilities which don't require any subject mangling.
--
slashdot: I miss my free time, Rob.
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2001-04-08 09:10 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-06 17:00 Permissons on database Boulat Khakimov <boulat@inet-interactif.com>
2001-03-06 17:09 ` Oliver Elphick <olly@lfix.co.uk>
2001-03-06 17:26 ` dev@archonet.com
2001-03-07 20:40 ` Roland Roberts <roland@astrofoto.org>
2001-03-13 02:20 ` Rob Arnold <rob@cabrion.com>
2001-04-08 09:10 ` Louis-David Mitterrand <vindex@apartia.ch>
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