perl-workflow / perl-workflow

Workflow - simple, flexible system to implement workflows/state machines

Home Page:https://jonasbn.github.io/perl-workflow/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use RETURNING clause and IDENTITY GENERATED ALWAYS for Ids

ehuelsmann opened this issue · comments

Issue Template

Description

PostgreSQL, Oracle, MySQL/MariaDB and SQLite all support RETURNING, which saves a "post-fetch".

All except SQLite support GENERATED ALWAYS AS IDENTITY. SQLite supports autoincrement. All of these allow RETURNING to indicate the ID primary key of the newly inserted row. All of the above also have functions to generate UUID columns.

Using the database to assign the row value instead of supplying one simplifies the code to insert a new workflow it history item.