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.89) (envelope-from ) id 1hiGYH-0001U6-BR for pgsql-general@arkaria.postgresql.org; Tue, 02 Jul 2019 11:02:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hiGYF-0006W6-OK for pgsql-general@arkaria.postgresql.org; Tue, 02 Jul 2019 11:02:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hiGYF-0006RW-Au for pgsql-general@lists.postgresql.org; Tue, 02 Jul 2019 11:02:19 +0000 Received: from mout.kundenserver.de ([212.227.126.187]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hiGYB-000196-M5 for pgsql-general@lists.postgresql.org; Tue, 02 Jul 2019 11:02:17 +0000 Received: from [10.8.0.6] ([185.40.248.10]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MSZDt-1i6DLZ3cnB-00SytN for ; Tue, 02 Jul 2019 13:02:12 +0200 Subject: Re: Sequences part 2 To: pgsql-general@lists.postgresql.org References: From: Thomas Kellerer Message-ID: Date: Tue, 2 Jul 2019 13:02:11 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:8vdmGRV4Yt8yTsX3AAjYv0DoadTcGzb56KHF6oGHyB2Gura9T4s o7rUPjwo4PzmVR4+KtW8WRq0pCzEmrh+9iggnKLk7pxmi2dXRzX0YaJiDo9lK02NS2CITb9 XnL2ChWysf4Zk8T9tP920u6bHMD+3QGttmFv1WYDkIFTL9KU2DJ7+3crO0CljMaijMBOm3b PT3RjNiLt+/CFNhVAsbMg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:tQ1yvaqpYL8=:Q9pdnr6WoIQ40S844nOgrL bpKeaIcgIW1TjUxYlzO0dbeoB5c1LSqFcV/Cp7Ki3z7slT8bxjlQ6+jXvsmlOWvc8q2zwiO7U aAoXGfy8MgRCxxuBWWuUMsu8BmVdibATPTplXzJ5C2Mshh+pp5l84l3qxcCX0uF6lQhPSquBv 0nuGAmeo3RGDKGs77ugek4+TYN2oB4dSBlDDJ2y/ibny97T2DCQNcfakhaJ7cNjo0p/6VwpHW hJbj2FRZVAe1uPsIoIx0JIVsVDnbTLJLro9WFx8/lZMjNGqm9/T5jGx57rf/0vjGFny99P74K 2+2bsD8dY6H+sfteGV9pACKAI/NNJyt5bdl3tE4/OhZarw9JlNglNe7tV+n8yfsbCPMDfzqyM fh12ZFPq2XkQCgpYob+15qDjeTPsYHNm7EJvT18VsKr/BpPZ/hvttI6WRqCo4BtelGEUxfqlu 8vqzzwuS1vkHEZhFcR0mD3KXD05it9yKGodW3HsSoGx4j13IUPsOW2GPhTDiUZqBRZEi4+G9D ENRB4pAG89GSX+9S9dnCcPYqFXHPBYqEraEI+xcAex+TXmb/EswuN4JjlEtKwJ8JAbicSohrF NGfjU4+hcVKNFcFoEPNAjSZmd3MibmPZ5H/HoTcDhCiNZDTTo4jdnDDRIMyzO/l5lkXyLVjYi F2MXUX162496M/LJtQRz0BwMtjQKXtBIWfMjKJbPfjlKpPBohuKT8xiq9KmNeMe0m8CNdFv22 G7lrgLMpw4x0KyN3xJpXYYlZHP18pEzOQq7d4C1k55tG92nJ5FSsm2FntVM= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Karl Martin Skoldebrand schrieb am 02.07.2019 um 12:44: > Looking more at sequences, I have some sequences that start with ID 1, incrementing each record by 1. > > So I have e.g. 1 Spain 2. Germany 3. France 4. Ireland 5. Norway > > Now I want to insert more countries, between France and Ireland. That is a wrong assumption - there is no "between" for rows in a relational database. Why do you think you need that? A sequence is used to generate a unique number. The only job of that number is to be unique. You should never rely on PK values to be "gapless" nor should you rely on them defining any kind of ordering. If you need to sort your countries in a non-default way, add a specific sort_order column to your table which you can use when selecting from the table.