Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UpFHU-0001V6-J7 for pgsql-admin@arkaria.postgresql.org; Wed, 19 Jun 2013 10:06:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UpFHT-0001ao-WA for pgsql-admin@arkaria.postgresql.org; Wed, 19 Jun 2013 10:06:24 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UpFHS-0001ah-Kr for pgsql-admin@postgresql.org; Wed, 19 Jun 2013 10:06:22 +0000 Received: from mail-pb0-x231.google.com ([2607:f8b0:400e:c01::231]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UpFHP-0004t3-K2 for pgsql-admin@postgresql.org; Wed, 19 Jun 2013 10:06:21 +0000 Received: by mail-pb0-f49.google.com with SMTP id jt11so4841588pbb.8 for ; Wed, 19 Jun 2013 03:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=G6lVqAIPktbdNxkJsKqQXZH1KX6O9QfMlit9wjwvHfA=; b=nTI4Qf6AZm5UComLF52xD+NPc8tm8TBnHLstmfPK6xZF6eFmG+lCD/0XlZmvSzBE+U 0nFWF51ffnRSyI3Au0MaQsgRyBcx5dbDwuUgbZQVu1MTozpn9CNn7eGNn4aKST66FLGI U0ss4EPzGMjsGtDGVijSmRwAD+BSnoEvTYfliDQVovhvFEzFPPFOpm/BxIcDQHD5uY24 w3yDKK8btj9iuOwnsJQVNYAM9HCFXro8HcMPzYaUuVVvDZvnfKuMaO44IQoIcDJCoA4+ d9SKVoZuxEV0B1Yxl2tvH/AX6cJqO0cm0+J6Xy78BdOpCWwnhxzJB7mKAsTtv1e6A29T 18fw== X-Received: by 10.66.190.234 with SMTP id gt10mr6098086pac.136.1371636378336; Wed, 19 Jun 2013 03:06:18 -0700 (PDT) Received: from [192.168.1.16] ([116.226.82.25]) by mx.google.com with ESMTPSA id cc15sm24171471pac.1.2013.06.19.03.06.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Jun 2013 03:06:17 -0700 (PDT) Message-ID: <51C18293.4030904@gmail.com> Date: Wed, 19 Jun 2013 18:06:11 +0800 From: Rural Hunter User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Szymon Guz CC: "pgsql-admin@postgresql.org" Subject: Re: Why sequence grant is separated from table? References: <51C17B74.4070109@gmail.com> In-Reply-To: Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: 1.4 (+) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org
于 2013/6/19 17:47, Szymon Guz 写道:
On 19 June 2013 11:35, Rural Hunter <ruralhunter@gmail.com> wrote:
I really hate the error "permission denied for sequence xxxxx" when I grant on a table but forget to grant additionally on the related sequence to users. Can the permission of table and related sequences be merged?


I can imagine a situation where you want a user to be granted rights on a table, to use sequence with curval and nextval functions, but not setval, as it can provide some database problems.
oh, is it possible to separately grant nextval and setval on sequence currently?

What's more, in general, you cannot say which sequence is used for which table, if the sequence is not owned by the table.
Can we get it from the column definition such as a serial column?

Which permissions of a table do you want to merge with which permissions of sequences?
At least granting insert on a table means to grant update on the sequence used by serial columns.

regards
Szymon