From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | salah jubeh <s_jubeh(at)yahoo(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: serial- sequence priveleges |
Date: | 2012-03-16 14:40:02 |
Message-ID: | 4F6350C2.6060408@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Albe Laurenz | 2012-03-16 15:09:02 | Re: how to measure wal_buffer usage |
Previous Message | Lonni J Friedman | 2012-03-16 14:20:30 | Re: how to measure wal_buffer usage |