Skip to content

Commit 6b5fb6a

Browse files
authored
feat(postgres): limit collection to current database (#454)
* Handle database names containing spaces * Remove functions and logic specific to Oracle and MySQL. * Handle database names containing spaces * Remove functions and logic specific to Oracle and MySQL. * Limit database_details to just the current database. * Limit database_details to just the current database. * Add filter to Python collector.
1 parent 397873e commit 6b5fb6a

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

scripts/collector/postgres/sql/12/database_details.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ with db as (
2222
pg_encoding_to_char(db.encoding) as character_set_encoding,
2323
pg_database_size(db.datname) as total_disk_size_bytes
2424
from pg_database db
25+
where datname = current_database()
2526
),
2627
db_size as (
2728
select s.datid as database_oid,

scripts/collector/postgres/sql/13/database_details.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ with db as (
2222
pg_encoding_to_char(db.encoding) as character_set_encoding,
2323
pg_database_size(db.datname) as total_disk_size_bytes
2424
from pg_database db
25+
where datname = current_database()
2526
),
2627
db_size as (
2728
select s.datid as database_oid,

scripts/collector/postgres/sql/base/database_details.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ with db as (
2222
pg_encoding_to_char(db.encoding) as character_set_encoding,
2323
pg_database_size(db.datname) as total_disk_size_bytes
2424
from pg_database db
25+
where datname = current_database()
2526
),
2627
db_size as (
2728
select s.datid as database_oid,

src/dma/collector/sql/sources/postgres/collection-database_details.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ with db as (
2323
pg_encoding_to_char(db.encoding) as character_set_encoding,
2424
pg_database_size(db.datname) as total_disk_size_bytes
2525
from pg_database db
26+
where datname = current_database()
2627
),
2728
db_size as (
2829
select s.datid as database_oid,
@@ -146,6 +147,7 @@ with db as (
146147
pg_encoding_to_char(db.encoding) as character_set_encoding,
147148
pg_database_size(db.datname) as total_disk_size_bytes
148149
from pg_database db
150+
where datname = current_database()
149151
),
150152
db_size as (
151153
select s.datid as database_oid,
@@ -269,6 +271,7 @@ with db as (
269271
pg_encoding_to_char(db.encoding) as character_set_encoding,
270272
pg_database_size(db.datname) as total_disk_size_bytes
271273
from pg_database db
274+
where datname = current_database()
272275
),
273276
db_size as (
274277
select s.datid as database_oid,

0 commit comments

Comments
 (0)