ownership of sequences

From: Chris <pggeneral(at)designmagick(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: ownership of sequences
Date: 2002-10-23 22:58:28
Message-ID: 4.3.2.7.2.20021024085531.00aa13b0@pop.iprimus.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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=>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2002-10-24 00:29:55 Re: Recover data from crashed HD
Previous Message Bruce David 2002-10-23 21:33:45 Trigger on 'create table' ?