PostgreSQL Identity tip

Hi Wapplers,

So with one of the latest updates, a bug was resolved where the “Identity” was not returned back when doing an Insert when using a PostgreSQL database. This has been resolved so all good.

But one should know, that the sequence names should be in a particular format in order to work with the DMX framework.

The format should be like " _id_seq ".

The sequence name is generated on table generation(if your table has an auto increment pk column). the name of the AI_PK column is used in the sequence so it might be not the same as what DMX framework expects.

Not having the correct sequence name will result in a NULL value being returned.

The easiest way is just to change your sequence names so it works like the mentioned format via either PGAdmin or via the stement “ALTER SEQUENCE name RENAME TO new_name”.

If you already have a naming convention for your sequences and use PHP for the framework, one could change the Connection.php (line: 119) to reflect this. Changing this is at your own risk so only do it if you are familiar with editing PHP code.( I only use the PHP framework version, so can’t help with the others).

Hope this tip might help someone :slight_smile:

Kind regards,

Nick

1 Like