Thank you all! Your answers cleared this up for me.
Tom, in particular, that reference commit removed any ambiguity for me.
Thank you. It's much appreciated.
On Tue, Jun 12, 2018 at 7:27 AM Tom Lane wrote:
> "David G. Johnston" writes:
> > On Tuesday, June 12, 2018, Steve Krenzel wrote:
> >>
"David G. Johnston" writes:
> On Tuesday, June 12, 2018, Steve Krenzel wrote:
>> This is relevant for tables that have a column with a SERIAL type, I need
>> to guarantee that the relative ordering remains the same as the ordering of
>> the selected result set.
> The logical insertion order, and
On 06/12/2018 01:39 AM, Steve Krenzel wrote:
This is relevant for tables that have a column with a SERIAL type, I
need to guarantee that the relative ordering remains the same as the
ordering of the selected result set.
More concretely, given:
> CREATE TABLE foo (id SERIAL, val TEXT);
On Tuesday, June 12, 2018, Steve Krenzel wrote:
> This is relevant for tables that have a column with a SERIAL type, I need
> to guarantee that the relative ordering remains the same as the ordering of
> the selected result set.
>
The logical insertion order, and thus the sequence values, will b
>Or to put it another way, I want to select values from one table ordered
by
>complex criteria and insert them into another table. I want to be able to
>retrieve the rows from the target table in the same order they were
inserted,
>but I don't care about the specific ordering criteria. I only care
This is relevant for tables that have a column with a SERIAL type, I need
to guarantee that the relative ordering remains the same as the ordering of
the selected result set.
More concretely, given:
> CREATE TABLE foo (id SERIAL, val TEXT);
> CREATE TABLE bar (id SERIAL, val TEXT);
>
Why is it even important? Once you use ORDER BY clause, you are guaranteed
to get the rows in the order. Why do you need how it was inserted in the
first place.
If I insert using the results of a select statement, are the inserts
guaranteed to happen in the order of the rows returned from the select?
That is, are these two equivalent:
INSERT INTO SELECT FROM ORDER BY DESC;
And:
FOR row IN SELECT FROM ORDER BY DESC LOOP
INSERT INT