Thread: table sequence

table sequence

From
"Crombleholme, Roy"
Date:
Hello, I've changed the owner of a table in a database from the super-user
to a normal user using the command ALTER TABLE table OWNER TO user;
This changed the owner of the table but not the sequence associated with it.
What is the command to do this.  I have trawled through numerous forums and
pages for the solution but could not find one.  I am running postgresql 7.2
on Solaris 8.

Roy Crombleholme
Trainee ICT Engineer
ICT Services
Resources Directorate
Lancashire County Council
01772 26-1849
01772 5-31849 (wef Easter Monday (21/04/03) )
Email:  roy.crombleholme@its.lancscc.gov.uk



********************
This e-mail contains information intended for the addressee only.
It may be confidential and may be the subject of legal and/or professional privilege.
If you are not the addressee you are not authorised to disseminate, distribute, copy or use this e-mail or any
attachmentto it 
The content may be personal or contain personal opinions and unless specifically stated or followed up in writing, the
contentcannot be taken to form a contract or to be an expression of the County Council's position. 
LCC reserves the right to monitor all incoming and outgoing email
LCC has taken reasonable steps to ensure that outgoing communications do not contain  malicious software and it is your
responsibilityto carry out any checks on this email before accepting the email and opening attachments. 
********************


Re: table sequence

From
"A.Bhuvaneswaran"
Date:
> Hello, I've changed the owner of a table in a database from the super-user
> to a normal user using the command ALTER TABLE table OWNER TO user;
> This changed the owner of the table but not the sequence associated with it.
> What is the command to do this.  I have trawled through numerous forums and
> pages for the solution but could not find one.  I am running postgresql 7.2
> on Solaris 8.

One among the way is,

1. Check the current value of that sequence
2. Drop that sequence as super user
3. Create the SAME sequence as non-super user with start value as previous
   current value.

regards,
bhuvaneswaran



Re: table sequence

From
Tom Lane
Date:
"Crombleholme, Roy" <Roy.Crombleholme@its.lancscc.gov.uk> writes:
> Hello, I've changed the owner of a table in a database from the super-user
> to a normal user using the command ALTER TABLE table OWNER TO user;
> This changed the owner of the table but not the sequence associated with it.
> What is the command to do this.

A sequence is a table for many purposes, including this one.  So, it's
ALTER TABLE seqname OWNER TO whoever.

            regards, tom lane