pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Mohamed Wael Khobalatte <mkhobalatte@grubhub.com>
To: pgsql-general@postgresql.org
Subject: Re: Switching Primary Keys to BigInt
Date: Tue, 21 Jul 2020 11:26:09 -0700
Message-ID: <c996f5f0-6385-20f0-a43d-9915d8d6e5ba@aklaver.com> (raw)
In-Reply-To: <1a7885cf-43b4-fc41-4825-190b6d2defc3@aklaver.com>
References: <CABZeWdybDVTgCQFZf0jDtj0p4yLxNrYd8aw61iFxY-Xt+fqPkw@mail.gmail.com>
	<1a7885cf-43b4-fc41-4825-190b6d2defc3@aklaver.com>

On 7/21/20 11:17 AM, Adrian Klaver wrote:
> On 7/21/20 8:30 AM, Mohamed Wael Khobalatte wrote:
>> Hi all,

>  > test_(aklaver)5432> alter table change_seq alter COLUMN id set data type
> bigint;
> ALTER TABLE
> test_(aklaver)5432> \d change_seq
>                              Table "public.change_seq"
>   Column |  Type  | Collation | Nullable |                Default
> --------+--------+-----------+----------+---------------------------------------- 
> 
>   id     | bigint |           | not null | 
> nextval('change_seq_id_seq'::regclass)
> Indexes:
>      "change_seq_pkey" PRIMARY KEY, btree (id)


Forgot sequences are bigint by default. It would not hurt to check 
pg_sequence just to make sure they are that. In that case the below is 
not needed.

> 
> test_(aklaver)5432> alter sequence change_seq_id_seq as bigint;
> ALTER SEQUENCE
> 
>>


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (17+ messages)  latest in thread

Message-ID: <c996f5f0-6385-20f0-a43d-9915d8d6e5ba@aklaver.com>
Permalink:  ../c996f5f0-6385-20f0-a43d-9915d8d6e5ba@aklaver.com/
Also on:    postgresql.org/message-id/c996f5f0-6385-20f0-a43d-9915d8d6e5ba@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, mkhobalatte@grubhub.com
  Subject: Re: Switching Primary Keys to BigInt
  In-Reply-To: <c996f5f0-6385-20f0-a43d-9915d8d6e5ba@aklaver.com>
  References: <CABZeWdybDVTgCQFZf0jDtj0p4yLxNrYd8aw61iFxY-Xt+fqPkw@mail.gmail.com> <1a7885cf-43b4-fc41-4825-190b6d2defc3@aklaver.com> <c996f5f0-6385-20f0-a43d-9915d8d6e5ba@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox