pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Keith Worthington <KeithW@NarrowPathInc.com>
To: Lynwood Stewart <lynwood@nwlink.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: truncating table permissions
Date: Fri, 04 Mar 2005 22:35:48 -0500
Message-ID: <42292914.6000209@NarrowPathInc.com> (raw)
In-Reply-To: <112ctegjgsa7a5f@corp.supernews.com>
References: <112ctegjgsa7a5f@corp.supernews.com>

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




view thread (3+ messages)  latest in thread

Message-ID: <42292914.6000209@NarrowPathInc.com>
Permalink:  ../42292914.6000209@NarrowPathInc.com/
Also on:    postgresql.org/message-id/42292914.6000209@NarrowPathInc.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: KeithW@NarrowPathInc.com, lynwood@nwlink.com
  Subject: Re: truncating table permissions
  In-Reply-To: <42292914.6000209@NarrowPathInc.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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