From 66b39c1f805df0811df7e8a1fed4a9aac49f9aa1 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 19 Sep 2024 14:17:11 +0200 Subject: [PATCH] fixes --- integration-tests/__tests__/schema-tests.spec.js | 2 +- plugins/dbgate-plugin-postgres/src/backend/drivers.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/integration-tests/__tests__/schema-tests.spec.js b/integration-tests/__tests__/schema-tests.spec.js index 8aa4b962..81fee01d 100644 --- a/integration-tests/__tests__/schema-tests.spec.js +++ b/integration-tests/__tests__/schema-tests.spec.js @@ -70,7 +70,7 @@ describe('Schema tests', () => { await driver.query(schemaConn, `create table myschema.myt1 (id int not null primary key)`); const structure1 = await driver.analyseFull(schemaConn); expect(structure1.tables.length).toEqual(1); - expect(structure1.tables[0].tableName).toEqual('myt1'); + expect(structure1.tables[0].pureName).toEqual('myt1'); }) ); }); diff --git a/plugins/dbgate-plugin-postgres/src/backend/drivers.js b/plugins/dbgate-plugin-postgres/src/backend/drivers.js index 6fdc6db1..1ec61d95 100644 --- a/plugins/dbgate-plugin-postgres/src/backend/drivers.js +++ b/plugins/dbgate-plugin-postgres/src/backend/drivers.js @@ -4,7 +4,8 @@ const stream = require('stream'); const driverBases = require('../frontend/drivers'); const Analyser = require('./Analyser'); const pg = require('pg'); -const { getLogger, createBulkInsertStreamBase, makeUniqueColumnNames } = global.DBGATE_PACKAGES['dbgate-tools']; +const { getLogger, createBulkInsertStreamBase, makeUniqueColumnNames, extractDbNameFromComposite } = + global.DBGATE_PACKAGES['dbgate-tools']; const logger = getLogger('postreDriver'); @@ -76,7 +77,7 @@ const drivers = driverBases.map(driverBase => ({ port: authType == 'socket' ? null : port, user, password, - database: database || 'postgres', + database: extractDbNameFromComposite(database) || 'postgres', ssl, application_name: 'DbGate', };