alter table serial->int

Поиск
Список
Период
Сортировка
От Erik Aronesty
Тема alter table serial->int
Дата
Msg-id ccd588d90711061359m57d95921mc28b74dec9f35f54@mail.gmail.com
обсуждение исходный текст
Ответы Re: alter table serial->int
Список 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

В списке pgsql-admin по дате отправления:

Предыдущее
От: Devrim GÜNDÜZ
Дата:
Сообщение: Re: Source of pgpool2 manual
Следующее
От: "j a"
Дата:
Сообщение: Re: Vacuum Doesn't Recover Disk Space