Re: serial- sequence priveleges - Mailing list pgsql-general

From Adrian Klaver
Subject Re: serial- sequence priveleges
Date
Msg-id 4F6350C2.6060408@gmail.com
Whole thread Raw
In response to serial- sequence priveleges  (salah jubeh <s_jubeh@yahoo.com>)
List pgsql-general
On 03/16/2012 07:06 AM, salah jubeh wrote:
> Hello,
>
> When creating a serial, a sequence is created automatically.
>
> CREATE TABLEtablename  (
>      colname  SERIAL
> );
>
> CREATE SEQUENCE tablename_colname_seq;
> CREATE TABLE tablename (
>      colname integer NOT NULL DEFAULT nextval('tablename_colname_seq')
> );
> ALTER SEQUENCE tablename_colname_seq OWNED BY tablename.colname;

The OWNED BY is for dependency tracking not privileges:

http://www.postgresql.org/docs/9.1/interactive/sql-altersequence.html
OWNED BY table.column
OWNED BY NONE
The OWNED BY option causes the sequence to be associated with a specific
table column, such that if that column (or its whole table) is dropped,
the sequence will be automatically dropped as well. If specified, this
association replaces any previously specified association for the
sequence. The specified table must have the same owner and be in the
same schema as the sequence. Specifying OWNED BY NONE removes any
existing association, making the sequence "free-standing".



>
>
> Should not a proper permissions based on the table privileges added to
> the sequence ?. For example, when a table has INSERT, UPDATE permissions
> on the table to a certain user, this should be taken into account.
>
> Regards
>
>


--
Adrian Klaver
adrian.klaver@gmail.com

pgsql-general by date:

Previous
From: Lonni J Friedman
Date:
Subject: Re: how to measure wal_buffer usage
Next
From: "Albe Laurenz"
Date:
Subject: Re: how to measure wal_buffer usage