On 05/02/2026 12:57, Lester Caine wrote:
> That is what I think I was expecting, and Flamerobin probably knows
> nothing about it although the DDL is looking correct. Just what
> generator it is using is perhaps the question but I can have a scout in
> the systems tables and see if there is anything there.
> Looks like I need to sort lastInsertId() in the pdo driver so it does
> not crash things :)
The generator backing the GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY
column is an implementation details you should _not_ rely on. You need
to use `INSERT ... RETURNING { * | <column-list>}` to obtain generated
values.
And even in manually written triggers to generate an id, using the
generator for lastInsertId() is the wrong way as the value you obtain
that way might be from a different transaction. There you should also
use `INSERT ... RETURNING { * | <column-list>}`.
Mark
--
Mark Rotteveel