mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 14:53:58 +00:00
postgres - show system databases when using separate schemas
This commit is contained in:
@@ -59,7 +59,7 @@ class Analyser extends DatabaseAnalyser {
|
|||||||
const query = super.createQuery(sql[resFileName], typeFields, replacements);
|
const query = super.createQuery(sql[resFileName], typeFields, replacements);
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
async _computeSingleObjectId() {
|
async _computeSingleObjectId() {
|
||||||
const { typeField, schemaName, pureName } = this.singleObjectFilter;
|
const { typeField, schemaName, pureName } = this.singleObjectFilter;
|
||||||
this.singleObjectId = `${typeField}:${schemaName || 'public'}.${pureName}`;
|
this.singleObjectId = `${typeField}:${schemaName || 'public'}.${pureName}`;
|
||||||
@@ -364,6 +364,10 @@ class Analyser extends DatabaseAnalyser {
|
|||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDefaultSchemaNameCondition() {
|
||||||
|
return `not in ('pg_catalog', 'pg_toast', 'information_schema')`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Analyser;
|
module.exports = Analyser;
|
||||||
|
|||||||
@@ -11,10 +11,7 @@ select
|
|||||||
column_default as "default_value"
|
column_default as "default_value"
|
||||||
from information_schema.columns
|
from information_schema.columns
|
||||||
where
|
where
|
||||||
table_schema <> 'information_schema'
|
table_schema !~ '^_timescaledb_'
|
||||||
and table_schema <> 'pg_catalog'
|
|
||||||
and table_schema !~ '^pg_toast'
|
|
||||||
and table_schema !~ '^_timescaledb_'
|
|
||||||
and (
|
and (
|
||||||
('tables:' || table_schema || '.' || table_name) =OBJECT_ID_CONDITION
|
('tables:' || table_schema || '.' || table_name) =OBJECT_ID_CONDITION
|
||||||
or
|
or
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ select
|
|||||||
from information_schema.table_constraints
|
from information_schema.table_constraints
|
||||||
inner join information_schema.key_column_usage on table_constraints.table_name = key_column_usage.table_name and table_constraints.constraint_name = key_column_usage.constraint_name
|
inner join information_schema.key_column_usage on table_constraints.table_name = key_column_usage.table_name and table_constraints.constraint_name = key_column_usage.constraint_name
|
||||||
where
|
where
|
||||||
table_constraints.table_schema <> 'information_schema'
|
table_constraints.table_schema !~ '^_timescaledb_'
|
||||||
and table_constraints.table_schema <> 'pg_catalog'
|
|
||||||
and table_constraints.table_schema !~ '^pg_toast'
|
|
||||||
and table_constraints.table_schema !~ '^_timescaledb_'
|
|
||||||
and table_constraints.constraint_type = 'PRIMARY KEY'
|
and table_constraints.constraint_type = 'PRIMARY KEY'
|
||||||
and ('tables:' || table_constraints.table_schema || '.' || table_constraints.table_name) =OBJECT_ID_CONDITION
|
and ('tables:' || table_constraints.table_schema || '.' || table_constraints.table_name) =OBJECT_ID_CONDITION
|
||||||
and table_constraints.table_schema =SCHEMA_NAME_CONDITION
|
and table_constraints.table_schema =SCHEMA_NAME_CONDITION
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ select
|
|||||||
md5(routine_definition) as "hash_code",
|
md5(routine_definition) as "hash_code",
|
||||||
routine_type as "object_type"
|
routine_type as "object_type"
|
||||||
from
|
from
|
||||||
information_schema.routines where routine_schema != 'information_schema' and routine_schema != 'pg_catalog' and routine_schema !~ '^_timescaledb_'
|
information_schema.routines where routine_schema !~ '^_timescaledb_'
|
||||||
and routine_type in ('PROCEDURE', 'FUNCTION') and routine_schema =SCHEMA_NAME_CONDITION
|
and routine_type in ('PROCEDURE', 'FUNCTION') and routine_schema =SCHEMA_NAME_CONDITION
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ select
|
|||||||
$typeAggFunc(data_type $typeAggParam) as "data_type",
|
$typeAggFunc(data_type $typeAggParam) as "data_type",
|
||||||
max(external_language) as "language"
|
max(external_language) as "language"
|
||||||
from
|
from
|
||||||
information_schema.routines where routine_schema != 'information_schema' and routine_schema != 'pg_catalog' and routine_schema !~ '^_timescaledb_'
|
information_schema.routines where routine_schema !~ '^_timescaledb_'
|
||||||
and routine_schema =SCHEMA_NAME_CONDITION
|
and routine_schema =SCHEMA_NAME_CONDITION
|
||||||
and (
|
and (
|
||||||
(routine_type = 'PROCEDURE' and ('procedures:' || routine_schema || '.' || routine_name) =OBJECT_ID_CONDITION)
|
(routine_type = 'PROCEDURE' and ('procedures:' || routine_schema || '.' || routine_name) =OBJECT_ID_CONDITION)
|
||||||
|
|||||||
@@ -3,10 +3,7 @@ select infoTables.table_schema as "schema_name", infoTables.table_name as "pure_
|
|||||||
from information_schema.tables infoTables
|
from information_schema.tables infoTables
|
||||||
where infoTables.table_type not like '%VIEW%'
|
where infoTables.table_type not like '%VIEW%'
|
||||||
and ('tables:' || infoTables.table_schema || '.' || infoTables.table_name) =OBJECT_ID_CONDITION
|
and ('tables:' || infoTables.table_schema || '.' || infoTables.table_name) =OBJECT_ID_CONDITION
|
||||||
and infoTables.table_schema <> 'pg_catalog'
|
|
||||||
and infoTables.table_schema <> 'information_schema'
|
|
||||||
and infoTables.table_schema <> 'pg_internal'
|
and infoTables.table_schema <> 'pg_internal'
|
||||||
and infoTables.table_schema !~ '^pg_toast'
|
|
||||||
and infoTables.table_schema !~ '^_timescaledb_'
|
and infoTables.table_schema !~ '^_timescaledb_'
|
||||||
and infoTables.table_schema =SCHEMA_NAME_CONDITION
|
and infoTables.table_schema =SCHEMA_NAME_CONDITION
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -21,10 +21,7 @@ select infoTables.table_schema as "schema_name", infoTables.table_name as "pure_
|
|||||||
from information_schema.tables infoTables
|
from information_schema.tables infoTables
|
||||||
where infoTables.table_type not like '%VIEW%'
|
where infoTables.table_type not like '%VIEW%'
|
||||||
and ('tables:' || infoTables.table_schema || '.' || infoTables.table_name) =OBJECT_ID_CONDITION
|
and ('tables:' || infoTables.table_schema || '.' || infoTables.table_name) =OBJECT_ID_CONDITION
|
||||||
and infoTables.table_schema <> 'pg_catalog'
|
|
||||||
and infoTables.table_schema <> 'information_schema'
|
|
||||||
and infoTables.table_schema <> 'pg_internal'
|
and infoTables.table_schema <> 'pg_internal'
|
||||||
and infoTables.table_schema !~ '^pg_toast'
|
|
||||||
and infoTables.table_schema !~ '^_timescaledb_'
|
and infoTables.table_schema !~ '^_timescaledb_'
|
||||||
and infoTables.table_schema =SCHEMA_NAME_CONDITION
|
and infoTables.table_schema =SCHEMA_NAME_CONDITION
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ select
|
|||||||
md5(view_definition) as "hash_code"
|
md5(view_definition) as "hash_code"
|
||||||
from
|
from
|
||||||
information_schema.views
|
information_schema.views
|
||||||
where table_schema != 'information_schema' and table_schema != 'pg_catalog' and table_schema !~ '^_timescaledb_' and table_schema =SCHEMA_NAME_CONDITION
|
where table_schema !~ '^_timescaledb_' and table_schema =SCHEMA_NAME_CONDITION
|
||||||
and ('views:' || table_schema || '.' || table_name) =OBJECT_ID_CONDITION
|
and ('views:' || table_schema || '.' || table_name) =OBJECT_ID_CONDITION
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user