Re: schema rename sequence issue

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: Sim Zacks <sim(at)compulab(dot)co(dot)il>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: schema rename sequence issue
Date: 2006-01-30 10:11:21
Message-ID: FDDDE7A7-8527-433A-993F-1539A73C31D3@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jan 30, 2006, at 19:03 , Sim Zacks wrote:

> I thought the pg_attrdef table was the defaults.
> Is there another table that contains the defaults

What I'm thinking of is this situation:

create table foo
(
foo_id serial primary key
, foo_value text not null unique
);

This will create a sequence (public.foo_id_key_seq, I think) as well
as a table
public.foo
(
foo_id integer primary key default nextval('public.foo_id_key_seq')
, foo_value text not null unique
);

(And some indexes as well, but we'll set those aside for now.)

You've renamed the schema, but I think you need to update the default
for the foo_id column manually, e.g.,

alter table stock.foo alter column foo_id set default = nextval
('stock.foo_id_key_seq');

Syntax not checked.

If this isn't what it is, perhaps someone else has an idea.

Michael Glaesemann
grzm myrealbox com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sim Zacks 2006-01-30 10:24:01 Re: schema rename sequence issue
Previous Message Sim Zacks 2006-01-30 10:03:41 Re: schema rename sequence issue