> Bruno Wolff III <[EMAIL PROTECTED]> writes: >> Christopher Kings-Lynne <[EMAIL PROTECTED]> wrote: >>> ... people want to be able to grant on all objects in a >>> database, etc:
For things like this I use simple, but super-powerful eval function: CREATE OR REPLACE FUNCTION eval(text) RETURNS int4 VOLATILE LANGUAGE 'plpgsql' SECURITY INVOKER AS 'DECLARE body ALIAS FOR $1; result INT; BEGIN EXECUTE body; GET DIAGNOSTICS result = ROW_COUNT; RETURN result; END; '; Then you say something like: SELECT eval('GRANT SELECT ON TABLE '||TABLE_NAME||' TO PUBLIC') FROM INFORMATION_SCHEMA.TABLES WHERE schema_name=current_schema() AND type_type='BASE TABLE'; Also works great for other similar operations, such as renaming, changing owners, etc... anything you can generate with SQL, which is quite a lot, really. Is this considered ok or extreme abuse? ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])