[GENERAL] Adding identity column to a non-empty table

Поиск
Список
Период
Сортировка
От Igal @ Lucee.org
Тема [GENERAL] Adding identity column to a non-empty table
Дата
Msg-id 37b3858b-0d61-0268-69cc-ff1868ac5255@lucee.org
обсуждение исходный текст
Ответы Re: [GENERAL] Adding identity column to a non-empty table
Список pgsql-general

Hello,

I'm trying to add an identity column to a table that has records (previously had a bigserial column which I removed):

  ALTER TABLE event_log
    ADD COLUMN r_id BIGINT GENERATED BY DEFAULT AS IDENTITY;

But I'm getting an error `column r_id contains null values`.

How can I add the column and populate it for the existing rows?

Thanks,

Igal Sapir
Lucee Core Developer
Lucee.org

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

Предыдущее
От: "Igal @ Lucee.org"
Дата:
Сообщение: Re: [GENERAL] Delete Duplicates with Using
Следующее
От: "Igal @ Lucee.org"
Дата:
Сообщение: Re: [GENERAL] Adding identity column to a non-empty table