Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jAglL-0002ZA-01 for pgsql-general@arkaria.postgresql.org; Sat, 07 Mar 2020 21:13:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jAglJ-0000oP-KU for pgsql-general@arkaria.postgresql.org; Sat, 07 Mar 2020 21:13:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jAglJ-0000oH-8Z for pgsql-general@lists.postgresql.org; Sat, 07 Mar 2020 21:13:33 +0000 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jAglH-0001NG-5b for pgsql-general@lists.postgresql.org; Sat, 07 Mar 2020 21:13:32 +0000 Received: by mail-oi1-x235.google.com with SMTP id q81so6334506oig.0 for ; Sat, 07 Mar 2020 13:13:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=1hOf5Z92a7cItF8jwJ+PI28YITt17yHoJnS1B1zGMJQ=; b=Ho1C5nA/KMijSHEUaZKB9TtxZ5G2FRZ7KOSMZVdUWqhqrIsDv6p4ncrzQikouOf2TY j4I805cKyLPaN9IAyaLE0pQW7f0DDXnCSUjdFuzhN7T/+eJDfPNk/ERQ2A9B/NXcYtDM VFsN/G9g2fyhxY4Za+FLwHrj3+hdeDzGWH+kotsPJHA4lwoRaTpCnWRJKMWliUF6X1wW LxfXPf1Oe8M10BrHyMwhMJ3VWexkLvHy9NZxxcn428ySl7yiIZP0xRhtjsP0UfZAqQBt DG/Dqb4gFA/D+qULw2tVP9f9fNdigGaS7+xlmRiOct8HdmkMv5ibs4CK8c1znXwB3Yho hoJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=1hOf5Z92a7cItF8jwJ+PI28YITt17yHoJnS1B1zGMJQ=; b=E6oPDCHwtmWrDij6rFs9EumWqfxYz3YqEbblsB7Fl5SqMSV4lM2Ej+M/daQMCZUl1C g1/vowHbN2oavulEFaIidcVCziHFIlkHFZ5etyMZnM4Xa4bnagbsHsmp7sEfORW/yIUR XAKMQGtEL4E633vXm2popAWU7xs2ks3cqIePj+Z4zGDaWR6aimmom+sBLoiXj1kGPfdP nm1WI1JaV7DwBtyubdx9m1OhuRhrSySHMCOaUxYPjC69anFAJLGomyKxA+WO/2zvoeLU T095K8IOAtzHgc51kM4WDS8Xld8h99so1StBKsOhjQiGni/5GzDspJrIzB/KAUGqWYyo kIjg== X-Gm-Message-State: ANhLgQ1k32X3CnCW+YKQtcuuqNJN1CThx+FS5SbC4mfR4JiD86NiMPuJ 8ytUiaKJmW5OHD5aqXowb1tcmTs4pAc= X-Google-Smtp-Source: ADFU+vtFEYWKEIRk9spr5LDYnbk1/kZJ4qXUYegPKzJ7/B3/DDigAeEZY2v0DaiPOgr19N+1EisyeA== X-Received: by 2002:aca:1e1a:: with SMTP id m26mr2597103oic.39.1583615609087; Sat, 07 Mar 2020 13:13:29 -0800 (PST) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id w15sm1339088oiw.43.2020.03.07.13.13.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 07 Mar 2020 13:13:28 -0800 (PST) Subject: Re: duplicate key value violates unique constraint To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: Date: Sat, 7 Mar 2020 15:13:26 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------C53864839162B9056D3E72C5" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------C53864839162B9056D3E72C5 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Asking the same question on multiple lists is strongly frowned upon. On 3/7/20 1:29 PM, Ashkar Dev wrote: > Hi all, > > how to fix a problem, suppose there is a table with id and username > > if I set the id to bigint so the limit is 9223372036854775807 > if I insert for example 3 rows > id    username > --    -------------- > 1     abc > 2     def > 3     ghi > > if I delete all rows and insert one another it is like > > id    username > --    -------------- > 4     jkl > > > So it doesn't start again from non-available id 1, so what is needed to do > to make the new inserts go into non-available id numbers? -- Angular momentum makes the world go 'round. --------------C53864839162B9056D3E72C5 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
Asking the same question on multiple lists is strongly frowned upon.

On 3/7/20 1:29 PM, Ashkar Dev wrote:
Hi all,

how to fix a problem, suppose there is a table with id and username

if I set the id to bigint so the limit is 9223372036854775807 
if I insert for example 3 rows
id    username
--    --------------
1     abc
2     def
3     ghi

if I delete all rows and insert one another it is like

id    username
--    --------------
4     jkl


So it doesn't start again from non-available id 1, so what is needed to do to make the new inserts go into non-available id numbers?

--
Angular momentum makes the world go 'round.
--------------C53864839162B9056D3E72C5--