Skip site navigation (1) Skip section navigation (2)

alter table schema, default sequences stay the same

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: alter table schema, default sequences stay the same
Date: 2010-06-29 12:09:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
I am using 8.2.17

I added a new schema and moved tables into it using

ALTER TABLE tblname SET SCHEMA newschema;

This moves the sequences referred to by the table to the new schema as
is specified by the manual.

> Associated indexes, constraints, and sequences owned by table columns
> are moved as well. 

I was very surprised to find that the default nextval functions still
refer to the sequence public.sequencename

I discovered this when I tried to insert and it told me the sequence
does not exist.

> id integer NOT NULL DEFAULT
> nextval(('public.tblname_id_seq'::text)::regclass)
Shouldn't this change automatically as well?
Is there an easy way to modify all the default values now?



pgsql-general by date

Next:From: A. KretschmerDate: 2010-06-29 12:20:51
Subject: Re: alter table schema, default sequences stay the same
Previous:From: Vibhor KumarDate: 2010-06-29 09:55:58
Subject: Re: [NOVICE] Prepared statement issue in Pgpool-II

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group