2015-04-30 19:47:07 +03:00
|
|
|
package statements
|
2014-11-21 23:46:31 +03:00
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
import (
|
|
|
|
_ "embed"
|
|
|
|
)
|
2016-01-13 06:33:44 +03:00
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
var (
|
|
|
|
//go:embed sql/databases.sql
|
|
|
|
Databases string
|
2016-01-13 06:33:44 +03:00
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
//go:embed sql/schemas.sql
|
|
|
|
Schemas string
|
2015-12-05 03:14:03 +03:00
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
//go:embed sql/info.sql
|
|
|
|
Info string
|
2015-12-05 03:14:03 +03:00
|
|
|
|
2023-01-18 01:05:15 +03:00
|
|
|
//go:embed sql/info_simple.sql
|
|
|
|
InfoSimple string
|
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
//go:embed sql/estimated_row_count.sql
|
|
|
|
EstimatedTableRowCount string
|
2014-11-21 23:46:31 +03:00
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
//go:embed sql/table_indexes.sql
|
|
|
|
TableIndexes string
|
2018-06-06 00:38:00 +03:00
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
//go:embed sql/table_constraints.sql
|
|
|
|
TableConstraints string
|
2014-11-21 23:46:31 +03:00
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
//go:embed sql/table_info.sql
|
|
|
|
TableInfo string
|
2015-03-21 19:46:14 +03:00
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
//go:embed sql/table_info_cockroach.sql
|
|
|
|
TableInfoCockroach string
|
2015-11-13 15:36:13 +03:00
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
//go:embed sql/table_schema.sql
|
|
|
|
TableSchema string
|
2016-01-18 00:00:33 +03:00
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
//go:embed sql/materialized_view.sql
|
|
|
|
MaterializedView string
|
2016-01-18 00:00:33 +03:00
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
//go:embed sql/objects.sql
|
|
|
|
Objects string
|
2017-05-10 06:51:26 +03:00
|
|
|
|
2023-01-23 23:10:26 +03:00
|
|
|
//go:embed sql/tables_stats.sql
|
|
|
|
TablesStats string
|
|
|
|
|
2022-12-07 20:58:07 +03:00
|
|
|
//go:embed sql/function.sql
|
|
|
|
Function string
|
|
|
|
|
2022-12-07 02:41:46 +03:00
|
|
|
// Activity queries for specific PG versions
|
2017-05-10 06:51:26 +03:00
|
|
|
Activity = map[string]string{
|
2018-12-13 21:14:10 +03:00
|
|
|
"default": "SELECT * FROM pg_stat_activity WHERE datname = current_database()",
|
|
|
|
"9.1": "SELECT datname, current_query, waiting, query_start, procpid as pid, datid, application_name, client_addr FROM pg_stat_activity WHERE datname = current_database()",
|
|
|
|
"9.2": "SELECT datname, query, state, waiting, query_start, state_change, pid, datid, application_name, client_addr FROM pg_stat_activity WHERE datname = current_database()",
|
|
|
|
"9.3": "SELECT datname, query, state, waiting, query_start, state_change, pid, datid, application_name, client_addr FROM pg_stat_activity WHERE datname = current_database()",
|
|
|
|
"9.4": "SELECT datname, query, state, waiting, query_start, state_change, pid, datid, application_name, client_addr FROM pg_stat_activity WHERE datname = current_database()",
|
|
|
|
"9.5": "SELECT datname, query, state, waiting, query_start, state_change, pid, datid, application_name, client_addr FROM pg_stat_activity WHERE datname = current_database()",
|
|
|
|
"9.6": "SELECT datname, query, state, wait_event, wait_event_type, query_start, state_change, pid, datid, application_name, client_addr FROM pg_stat_activity WHERE datname = current_database()",
|
2017-05-10 06:51:26 +03:00
|
|
|
}
|
|
|
|
)
|