News for hackers. Stuff that matters.
Re:Why Does Everyone Run Ancient Postgres Versions? by evanelias on Friday October 18, 2024 @05:44PM (#41883777)
Thanks, that makes sense.

In this specific situation, the most common MySQL/MariaDB pattern would be to use LAST_INSERT_ID() in the second INSERT, assuming the order IDs are auto-increments. Or with UUIDs, simply generating the ID prior to the first INSERT, either on the application side or in a database-side session variable.

To avoid extra network calls, this could be wrapped in a stored proc, although a fair complaint is that MySQL doesn't support a ton of different programming langauges for procs/funcs like Postgres.

There are no comments on this comment yet.