feat(database): modify PostgreSQL insert query to return the entire inserted row for tables without an "id" column
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m35s

This commit is contained in:
2026-03-10 15:14:03 +01:00
parent 11d3972a74
commit a7b0b84f2d

View File

@@ -83,7 +83,9 @@ class PostgresAdapter {
let pgSql = convertPlaceholders(sql);
const isInsert = /^\s*INSERT/i.test(pgSql);
if (isInsert && !/RETURNING/i.test(pgSql)) {
pgSql += ' RETURNING id';
// Some tables (e.g. settings, oauth_states) have no "id" column.
// Return the inserted row generically and read id only when present.
pgSql += ' RETURNING *';
}
const result = await this.pool.query(pgSql, params);
return {