From 10d5667c8353522ccea01daae97982bcf5684bdc Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sun, 12 Feb 2023 12:31:38 +0100 Subject: [PATCH] pg fix --- plugins/dbgate-plugin-postgres/src/frontend/Dumper.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/dbgate-plugin-postgres/src/frontend/Dumper.js b/plugins/dbgate-plugin-postgres/src/frontend/Dumper.js index c51b42b3..08e7421c 100644 --- a/plugins/dbgate-plugin-postgres/src/frontend/Dumper.js +++ b/plugins/dbgate-plugin-postgres/src/frontend/Dumper.js @@ -101,11 +101,8 @@ class Dumper extends SqlDumper { } selectScopeIdentity(table) { - this.put( - "^SELECT currval(pg_get_serial_sequence('%f','%s'))", - table, - table.columns?.find(x => x.autoIncrement)?.[0]?.columnName - ); + const column = table.columns?.find(x => x.autoIncrement); + this.put("^SELECT currval(pg_get_serial_sequence('%f','%s'))", table, column ? column.columnName : null); } }