Re: Sequences part 2

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Sequences part 2
Date: 2019-07-02 11:53:10
Message-ID: 718af8b0-d6e9-a059-9cc8-4806d3466e13@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2019-07-02 13:28:34 Re: Statistics tables not being updated anymore
Previous Message Karl Martin Skoldebrand 2019-07-02 11:42:57 RE: Sequences part 2