X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 104D0475425 for ; Sat, 1 Feb 2003 18:42:04 -0500 (EST) Received: from ece.rice.edu (ece.rice.edu [128.42.4.34]) by postgresql.org (Postfix) with ESMTP id 96B6C474E53 for ; Sat, 1 Feb 2003 18:42:03 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by ece.rice.edu (Postfix) with SMTP id C8D5A68A6B; Sat, 1 Feb 2003 17:42:05 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by ece.rice.edu (Postfix) with ESMTP id 3AFD468A68; Sat, 1 Feb 2003 17:42:05 -0600 (CST) Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154]) by ece.rice.edu (Postfix) with ESMTP id F02AE68A66; Sat, 1 Feb 2003 17:42:03 -0600 (CST) Received: from reedstrm by wallace.ece.rice.edu with local (Exim 3.36 #1 (Debian)) id 18f7Gt-0000SF-00; Sat, 01 Feb 2003 17:42:03 -0600 Date: Sat, 1 Feb 2003 17:42:03 -0600 From: "Ross J. Reedstrom" To: Matthew Horoschun , pgsql-sql@postgresql.org Subject: Re: Controlling access to Sequences Message-ID: <20030201234203.GB1300@wallace.ece.rice.edu> Mail-Followup-To: "Ross J. Reedstrom" , Matthew Horoschun , pgsql-sql@postgresql.org References: <2759DB60-351A-11D7-92E5-000393B3A702@canprint.com.au> <20030201063950.GA21857@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030201063950.GA21857@wolff.to> User-Agent: Mutt/1.4i X-Virus-Scanned: by AMaViS snapshot-20020300 X-DCC--Metrics: ece.rice.edu 1067; Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/10 X-Sequence-Number: 11408 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 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