From a7b0b84f2d0f2eded235a744f3126e70ac735334 Mon Sep 17 00:00:00 2001 From: Michelle Date: Tue, 10 Mar 2026 15:14:03 +0100 Subject: [PATCH] feat(database): modify PostgreSQL insert query to return the entire inserted row for tables without an "id" column --- server/config/database.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/config/database.js b/server/config/database.js index 47b4e1a..8e87430 100644 --- a/server/config/database.js +++ b/server/config/database.js @@ -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 {