From 55f7f39efd11a01e99dd001a95b225909cd0a05a Mon Sep 17 00:00:00 2001 From: "SPRINX0\\prochazka" Date: Tue, 24 Sep 2024 08:59:58 +0200 Subject: [PATCH] postgres - user current_schema instead of search_path --- plugins/dbgate-plugin-postgres/src/backend/drivers.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/dbgate-plugin-postgres/src/backend/drivers.js b/plugins/dbgate-plugin-postgres/src/backend/drivers.js index 9e14f08e1..47707a5e7 100644 --- a/plugins/dbgate-plugin-postgres/src/backend/drivers.js +++ b/plugins/dbgate-plugin-postgres/src/backend/drivers.js @@ -277,15 +277,15 @@ const drivers = driverBases.map(driverBase => ({ dbhan, 'select oid as "object_id", nspname as "schema_name" from pg_catalog.pg_namespace' ); - const defaultSchemaRows = await this.query(dbhan, 'SHOW SEARCH_PATH;'); - const searchPath = defaultSchemaRows.rows[0]?.search_path?.replace('"$user",', '')?.trim(); + const defaultSchemaRows = await this.query(dbhan, 'SELECT current_schema'); + const defaultSchema = defaultSchemaRows.rows[0]?.current_schema?.trim(); logger.debug(`Loaded ${schemaRows.rows.length} postgres schemas`); const schemas = schemaRows.rows.map(x => ({ schemaName: x.schema_name, objectId: x.object_id, - isDefault: x.schema_name == searchPath, + isDefault: x.schema_name == defaultSchema, })); return schemas;