pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
truncating table permissions
3+ messages / 3 participants
[nested] [flat]

* truncating table permissions
@ 2005-03-03 02:30  Lynwood Stewart <lynwood@nwlink.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Lynwood Stewart @ 2005-03-03 02:30 UTC (permalink / raw)
  To: pgsql-sql

I was expecting "truncate table <tablename>" to truncate a table if I had 
delete permissions.  This does not appear to be the case.

Would someone confirm this for me, or let me know what I am doing wrong.

-- 
Lyn 





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: truncating table permissions
@ 2005-03-05 03:35  Keith Worthington <KeithW@NarrowPathInc.com>
  parent: Lynwood Stewart <lynwood@nwlink.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Keith Worthington @ 2005-03-05 03:35 UTC (permalink / raw)
  To: Lynwood Stewart <lynwood@nwlink.com>; +Cc: pgsql-sql

Lynwood Stewart wrote:

>I was expecting "truncate table <tablename>" to truncate a table if I had 
>delete permissions.  This does not appear to be the case.
>
>Would someone confirm this for me, or let me know what I am doing wrong.
>
>  
>
This is the case.  You are not doing anything wrong.  There was a 
discussion on this on the NOVICE list beginning on 2/22.  The subject 
was "Question on TRUNCATE privileges"

At the end of the day the answer is to have the table owner create a 
truncate function with SECURITY DEFINER privilege.

The following is from Tom Lane.

   See CREATE FUNCTION.  Something like (untested)

   create function truncate_my_table() returns void as
   $$ truncate my_table $$ language sql security definer;

   You'd probably then revoke the default public EXECUTE
   rights on this function, and grant EXECUTE only to
   selected users.

-- 
Kind Regards,
Keith




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: truncating table permissions
@ 2005-03-05 05:02  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Lynwood Stewart <lynwood@nwlink.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2005-03-05 05:02 UTC (permalink / raw)
  To: Lynwood Stewart <lynwood@nwlink.com>; +Cc: pgsql-sql

"Lynwood Stewart" <lynwood@nwlink.com> writes:
> I was expecting "truncate table <tablename>" to truncate a table if I had 
> delete permissions.  This does not appear to be the case.

No, TRUNCATE is restricted to the table's owner, regardless of any
grantable permissions.

This was (ahem) inadequately documented until very recently.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-03-05 05:02 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-03 02:30 truncating table permissions Lynwood Stewart <lynwood@nwlink.com>
2005-03-05 03:35 ` Keith Worthington <KeithW@NarrowPathInc.com>
2005-03-05 05:02 ` Tom Lane <tgl@sss.pgh.pa.us>

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