Re: BUG #1083: Insert query reordering interacts badly with

Поиск
Список
Период
Сортировка
От Martin Langhoff
Тема Re: BUG #1083: Insert query reordering interacts badly with
Дата
Msg-id 403B2BD4.1060908@catalyst.net.nz
обсуждение исходный текст
Ответ на Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #1083: Insert query reordering interacts badly with  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-bugs
Tom Lane wrote:

>How about
>
>SELECT nextval('seq');       -- ignore result
>
>INSERT INTO ... VALUES (currval('seq'), currval('seq'));
>
>

Well, it works for my sample case, I have to agree. Maybe I should
mention that I tried to boil down the bugreport to the simplest repro
case I could.

My actual SQL looks roughly like

    INSERT INTO destination (record_id, page, row)
    SELECT
        (SELECT record_id FROM record ORDERED BY name),
        (NEXTVAL('seq') / 200),
        (CURRVAL('seq') % 200)

While I have a workaround, I am definitely curious as to whether there
is actually a way to do it. Thanks for your patience.



regards,





martin

--
-----------------------------------------------------------------------
Martin @ Catalyst .Net .NZ  Ltd, PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/           PHYS: Level 2, 150-154 Willis St
OFFICE: +64(4)916-7224                              MOB: +64(21)364-017
      Make things as simple as possible, but no simpler - Einstein
-----------------------------------------------------------------------

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

Предыдущее
От: "Gary WAN"
Дата:
Сообщение: The syntax about CREATE DOMAIN
Следующее
От: Richard Neill
Дата:
Сообщение: Re: BUG #1082: Order by doesn't sort correctly.