Semantics around INSERT INTO with SELECT and ORDER BY.

Поиск
Список
Период
Сортировка
От Steve Krenzel
Тема Semantics around INSERT INTO with SELECT and ORDER BY.
Дата
Msg-id CADBwkHv1nUx5bqxqRLp26k8iUWSnY3uW-1_0EMYxKns0t2JnUA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Semantics around INSERT INTO with SELECT and ORDER BY.
Список pgsql-general
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 <table2> SELECT <field> FROM <table1> ORDER BY <col> DESC;

And:

    FOR row IN SELECT <field> FROM <table1> ORDER BY <col> DESC LOOP
        INSERT INTO <table2> VALUES (row.<field>);
    END LOOP;

I read through the SQL spec on insertion but they don't address insertion ordering (perhaps, purposefully).

Any clarification here would be super helpful.

Thank you!
Steve

В списке pgsql-general по дате отправления:

Предыдущее
От: "a"
Дата:
Сообщение: Does pgAgent support chinese, japanese characters?
Следующее
От: Ravi Krishna
Дата:
Сообщение: Re: Semantics around INSERT INTO with SELECT and ORDER BY.