File size: 501 Bytes
d2c5e3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- server/resources/sql/list_database_info.sql
-- Returns basic information about the current database in JSON format

SELECT jsonb_build_object(
    'database',
    jsonb_build_object(
        'name', current_database(),
        'description', (
            SELECT description
            FROM pg_shdescription
            JOIN pg_database ON pg_database.oid = pg_shdescription.objoid
            WHERE pg_database.datname = current_database()
            LIMIT 1
        )
    )
) AS database_info;