Re: Controlling access to Sequences - Mailing list pgsql-sql

From Ross J. Reedstrom
Subject Re: Controlling access to Sequences
Date
Msg-id 20030201234203.GB1300@wallace.ece.rice.edu
Whole thread Raw
In response to Re: Controlling access to Sequences  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-sql
On Sat, Feb 01, 2003 at 12:39:50AM -0600, Bruno Wolff III wrote:
> On Fri, Jan 31, 2003 at 23:47:27 +1100,
>   Matthew Horoschun <mhoroschun@canprint.com.au> wrote:
> > 
> > Is there any effective method for controlling access to a SEQUENCE? or 
> > should I do something like in the view:
> 
> You can limit access to nextval by only allowing access through a user
> defined function that runs as the definer. If you only want them to use
> the function when doing an insert into a specific table, then I am not
> sure if you can do this easily. At worst you could write a function
> that does the insert.

Define your 'suid_nextval()' as Bruno suggests, then instead of using the
'serial' convience type, define your own that uses your function as the
default, rather than nextval().

Ross


pgsql-sql by date:

Previous
From: pginfo
Date:
Subject: Re: update and IN vs. EXISTS
Next
From: Agnieszka Rutkowska
Date:
Subject: extracting constraints from schema