Re: Change column type from int to bigint - quickest way

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Change column type from int to bigint - quickest way
Дата
Msg-id CAHyXU0xDCvKYy0eDyArembDbcy8EAo8FhDBhSJDkCB7q2NazNA@mail.gmail.com
обсуждение исходный текст
Ответ на Change column type from int to bigint - quickest way  (Andreas Brandl <mail@andreas-brandl.de>)
Ответы Re: Change column type from int to bigint - quickest way  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
On Fri, Nov 11, 2016 at 9:30 AM, Andreas Brandl <mail@andreas-brandl.de> wrote:
> Hi,
>
> we have a pretty big table with an integer-type primary key. I'm looking for the quickest way to change the column
typeto bigint to avoid hitting the integer limit. We're trying to avoid prolonged lock situations and full table
rewrites.
>
> I know I can hack this with an UPDATE on pg_attribute:
>
> -- change id type to bigint
> update pg_attribute set atttypid=20 where attrelid=264782 and attname = 'id';
>
> After that I'd need to reflect the change on dependent objects like views as well.
>
> Is this safe to do? Are there any unwanted consequences to this?
>
> This is still on 9.1 unfortunately - upgrade is going to follow soon after this.

You just posted the same question a few days ago -- were the answers
there unsatisfactory?

merlin


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

Предыдущее
От: cen
Дата:
Сообщение: Full text search tsv column aproach vs concat confusion
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: Upgrade from 9.5.4 to 9.6.1