ownership of sequences - Mailing list pgsql-general

From Chris
Subject ownership of sequences
Date
Msg-id 4.3.2.7.2.20021024085531.00aa13b0@pop.iprimus.com.au
Whole thread Raw
Responses Re: ownership of sequences  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi,

Is there an easy way to alter the owner of a sequence or does it have to be
created by the right user in the first place ?

foo=# create user a with nocreatedb nocreateuser;
foo=# create schema a authorization a;
foo=# create table a.a(id serial, name text);
foo=# set search_path='a';
foo=# \d
           List of relations
  Schema |   Name   |   Type   | Owner
--------+----------+----------+-------
  a      | a        | table    | pgsql
  a      | a_id_seq | sequence | pgsql
(2 rows)

foo=# alter table a owner to a;
foo=# \d
           List of relations
  Schema |   Name   |   Type   | Owner
--------+----------+----------+-------
  a      | a        | table    | a
  a      | a_id_seq | sequence | pgsql
(2 rows)

foo=# \c - a
foo=> insert into a(name) values ('blah');
ERROR:  a_id_seq.nextval: you don't have permissions to set sequence a_id_seq
foo=>


pgsql-general by date:

Previous
From: "Bruce David"
Date:
Subject: Trigger on 'create table' ?
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Recover data from crashed HD