pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Sequences part 2
Date: Tue, 2 Jul 2019 13:53:10 +0200
Message-ID: <718af8b0-d6e9-a059-9cc8-4806d3466e13@gmx.net> (raw)
In-Reply-To: <4f61207408b84e9f8e6f36f1476f928d@UKEXCHMBX003.TechMahindra.com>
References: <c5ee3f2d96c4410b88ac9d4492fe1773@UKEXCHMBX003.TechMahindra.com>
	<bd21060f-c6ce-8c1f-ebe2-e2b594edb60b@gmx.net>
	<4f61207408b84e9f8e6f36f1476f928d@UKEXCHMBX003.TechMahindra.com>

Karl Martin Skoldebrand schrieb am 02.07.2019 um 13:20:
>>> 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.
>> 
> 
> Yes, I'm fairly aware of this. However the application the 
> database table belongs to seems to rely on a specific order in the 
> database. I.e. if I just add value to the table they end up, possibly
> due to how the application is coded in an undesireable spot on the
> web page. That is why I wanted them to be inserted with the previous
> records.
There is no "order of rows" in a relational database. 

Even _if_ you squeeze the IDs of the new rows between existing ones, 
you still have no guarantee whatsoever on the order of the rows 
returned by a SELECT statement. 

The only(!) way to get a guaranteed sort order is to use ORDER BY. 

Thomas





view thread (6+ messages)

Message-ID: <718af8b0-d6e9-a059-9cc8-4806d3466e13@gmx.net>
Permalink:  ../718af8b0-d6e9-a059-9cc8-4806d3466e13@gmx.net/
Also on:    postgresql.org/message-id/718af8b0-d6e9-a059-9cc8-4806d3466e13@gmx.net

 · 

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: spam_eater@gmx.net
  Subject: Re: Sequences part 2
  In-Reply-To: <718af8b0-d6e9-a059-9cc8-4806d3466e13@gmx.net>
  References: <c5ee3f2d96c4410b88ac9d4492fe1773@UKEXCHMBX003.TechMahindra.com> <bd21060f-c6ce-8c1f-ebe2-e2b594edb60b@gmx.net> <4f61207408b84e9f8e6f36f1476f928d@UKEXCHMBX003.TechMahindra.com> <718af8b0-d6e9-a059-9cc8-4806d3466e13@gmx.net>

* 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