peter,
thanks for the explanation. i was using in rls db_mode=0 when i saw the error message. i then switched to db_mode=2 for rls just in case you had fixed something there and i haven't seen the error since then although i'm using mysql where your fix should not help.
The temporary dialog record cannot be created until after the SUBSCRIBE has been sent (the call-id and from-tag are generated by the TM module). This means, on a single server with RLS back-end subscriptions over the local loopback, it is theoretically possible for the SUBSCRIBE to be sent and the 2XX generated, sent, received, and processed before the temporary record is created.
i have exactly the above situation, i.e., backend subscriptions are send over loopback interface.
i'll keep on watching if i see the error again with db_mode=2. it would be nice to get your DB API enhancement implemented for mysql too.
-- juha