From: | "Erik Aronesty" <erik(at)q32(dot)com> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | alter table serial->int |
Date: | 2007-11-06 21:59:44 |
Message-ID: | ccd588d90711061359m57d95921mc28b74dec9f35f54@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
for some odd reason when i try to change a table fromserial to just
plain "int with a default" postgres seems to ignore me.
when i dump the schema i get ...
CREATE TABLE custom (
id serial NOT NULL,
name text,
email text,
);
then i run...
alter table custom alter id type int;
alter table custom alter id set default
((nextval('custom_seq'::regclass) * 100) + ((random() * (100)::double
precision))::integer);
after running these 2 alter table commands... i dump the schema ...
and voila... nothing happened....
CREATE TABLE custom (
id serial NOT NULL,
name text,
email text,
);
or did it? the change actually works... i see the new slightly
randomized ids going in nicely
my only problem is that backups aren't going to restore correctly
since the schema dumps wrong
From | Date | Subject | |
---|---|---|---|
Next Message | j a | 2007-11-07 00:19:16 | Re: Vacuum Doesn't Recover Disk Space |
Previous Message | Devrim GÜNDÜZ | 2007-11-06 19:40:01 | Re: Source of pgpool2 manual |