Truncate Permission - Mailing list pgsql-hackers

From Nick Barr
Subject Truncate Permission
Date
Msg-id 466ADD44.9060009@chuckie.co.uk
Whole thread Raw
Responses Re: Truncate Permission
List pgsql-hackers
Hi,

I was looking to start development on the following TODO entry.

Add a separate TRUNCATE permission

Currently only the owner can TRUNCATE a table because triggers are not called, and the table is locked in exclusive
mode.


Does anyone have any objections? Looks like there is a change freeze on 
at the moment, so I assume my patch will not get reviewed until 8.4 
starts development?

Now some functional questions...

1. I assume you want something like the following?

grant truncate on [table] bla to user;
revoke truncate on [table] bla from user;

Are there any other statements that need to be included?

2. When executing a truncate command, the owner permission check is 
replaced by a truncate privilege check. Would you prefer both privileges 
to be checked?

3. Can I reuse the old ACL_RULE bit position and display character?

src/include/nodes/parsenodes.h - 1<<4
src/include/utils/acl.h - character 'R'

Will this break dump/restores? I would have preferred to use 't' or 'T' 
but these are both used.

4. Should the truncate permission be contained within the all 
privileges? If a user does

grant all [privileges] on [table] bla to user;
revoke all [privileges] on [table] bla from user;

If everyone is too busy at the moment with the 8.3 release, let me know 
and I will resubmit this stuff in a couple of months when things have 
calmed down.

Ta

Nick



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Avoiding legal email signatures
Next
From: Tom Lane
Date:
Subject: Re: Truncate Permission