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
-----------------------------------------------------------------------


---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Reply via email to