Re: GRANT ON ALL IN schema

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Nikhil Sontakke <nikhil(dot)sontakke(at)enterprisedb(dot)com>, Petr Jelinek <pjmodos(at)pjmodos(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>
Subject: Re: GRANT ON ALL IN schema
Date: 2009-08-10 17:15:39
Message-ID: 162867790908101015l4ce4cc34n6ba03b5673511bc1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/8/10 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Mon, Aug 10, 2009 at 11:36 AM, Tom Lane<tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>>> One fairly simple way would use a new SQL verb (say, DO) like this:
>>
>>> DO $$ something in plfoo $$ LANGUAGE plfoo;
>>
>> Yeah, this has been suggested before.  I can't see anything very wrong
>> with it.
>>
>>> We could even default the langauge to plpgsql, for which you would then
>>> just need:
>>
>>> DO $$ something in plpgsql $$;
>>
>> Add a GUC variable to set the default language, perhaps?
>>
>>> But to make it really nice you'd have to move away from pl programs as
>>> strings. That would be a lot more work, and you really wouldn't want to
>>> make it work with more than one PL for the sake of everyone's sanity.
>>
>> That would be an awful lot of messiness to save four keystrokes...
>
> I think it would be awfully handy to integrate some of the features of
> PL/pgsql into core SQL - especially variables, and also things like IF
> and FOR...  but I'm not expecting it to happen any time soon, or maybe
> ever.
>

SQL/PSM is better. This language is developed to integration to SQL.
It allows one statement procedures. So

IF .. THEN ELSE END IF; isn't correct code for PL/pgSQL and it is
correct for SQL/PSM.

so
FOR r AS
SELECT * FROM information_schema.tables
DO
GRANT .... ON r.table_name TO ...;
END FOR;

sql/psm doesn't need DECLARE, BEGIN and END in this case;

http://www.postgres.cz/index.php/SQL/PSM_Manual

regards
Pavel Stehule

> ...Robert
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2009-08-10 17:20:37 Re: hot standby - merged up to CVS HEAD
Previous Message Greg Stark 2009-08-10 17:15:25 Re: Patch for 8.5, transformationHook