Re: Convert serial column to regular integer

Поиск
Список
Период
Сортировка
От Rodrigo De León
Тема Re: Convert serial column to regular integer
Дата
Msg-id a55915760705110936j1ee5bb67oe366c9161c92fc33@mail.gmail.com
обсуждение исходный текст
Ответ на Convert serial column to regular integer  ("Collin Peters" <cadiolis@gmail.com>)
Ответы Re: Convert serial column to regular integer  ("Collin Peters" <cadiolis@gmail.com>)
Re: Convert serial column to regular integer  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
On 5/11/07, Collin Peters <cadiolis@gmail.com> wrote:
> I have a need to convert an incorrectly typed serial column to a
> regular integer column.  Basically this just involves removing the
> sequence.  I am able to successfully remove the default value (DROP
> DEFAULT) (which seems to use nextval) and now pgadmin does show the
> column as an integer, but I cannot remove the sequence as it says it
> is still in use.  If I look at the column in pgadmin the sequence
> field is still filled in with the sequence but it is grayed out.  Is
> there any way to remove the sequence fully?
>
> Regards,
> Collin

CREATE TABLE dtab (i SERIAL);

ALTER TABLE dtab ALTER COLUMN i DROP DEFAULT;

ALTER SEQUENCE dtab_i_seq OWNED BY NONE;

DROP SEQUENCE dtab_i_seq;


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

Предыдущее
От: "Collin Peters"
Дата:
Сообщение: Convert serial column to regular integer
Следующее
От: imad
Дата:
Сообщение: Re: PL/PGSQL Record type question