RE: Sequences part 2 - Mailing list pgsql-general

From Karl Martin Skoldebrand
Subject RE: Sequences part 2
Date
Msg-id 4f61207408b84e9f8e6f36f1476f928d@UKEXCHMBX003.TechMahindra.com
Whole thread Raw
In response to Re: Sequences part 2  (Thomas Kellerer <spam_eater@gmx.net>)
Responses Re: Sequences part 2
Re: Sequences part 2
List pgsql-general
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. 

------
Yes, I'm fairly aware of this. However the application the database table belongs to seems to rely on a specific order
inthe database. I.e. if I just add value to the table they end up, possibly due to how the application is coded in an
undesireablespot on the web page.
 
That is why I wanted them to be inserted with the previous records.

//Martin S


============================================================================================================================

Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech
Mahindrapolicy statement, you may review the policy at http://www.techmahindra.com/Disclaimer.html
<http://www.techmahindra.com/Disclaimer.html>externally http://tim.techmahindra.com/tim/disclaimer.html
<http://tim.techmahindra.com/tim/disclaimer.html>internally within TechMahindra. 


============================================================================================================================

pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Sequences part 2
Next
From: Karsten Hilbert
Date:
Subject: Re: Sequences part 2