sugoll (sugoll) wrote,

MySQL question

Assume you've got a table with an auto-incrementing field (primary key), and a bunch of other, non-unique fields, in a table of the default type (i.e. no transactions). Is there any way to reliably find out the newly-assigned primary key when you insert a new row? Right now, I'm just re-querying for the values just inserted, but non-uniqueness can make that problematic. Can't just go for the highest key, as the lack of transactions means someone else might insert something in parallel.
Tags: mysql
  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.