pgweb/pkg/statements/sql.go

61 lines
2.0 KiB
Go
Raw Normal View History

2015-04-30 19:47:07 +03:00
package statements
import (
_ "embed"
)
2016-01-13 06:33:44 +03:00
var (
//go:embed sql/databases.sql
Databases string
2016-01-13 06:33:44 +03:00
//go:embed sql/schemas.sql
Schemas string
2015-12-05 03:14:03 +03:00
//go:embed sql/info.sql
Info string
2015-12-05 03:14:03 +03:00
//go:embed sql/info_simple.sql
InfoSimple string
//go:embed sql/estimated_row_count.sql
EstimatedTableRowCount string
//go:embed sql/table_indexes.sql
TableIndexes string
//go:embed sql/table_constraints.sql
TableConstraints string
//go:embed sql/table_info.sql
TableInfo string
//go:embed sql/table_info_cockroach.sql
TableInfoCockroach string
2015-11-13 15:36:13 +03:00
//go:embed sql/table_schema.sql
TableSchema string
//go:embed sql/materialized_view.sql
MaterializedView string
//go:embed sql/objects.sql
Objects string
//go:embed sql/tables_stats.sql
TablesStats string
//go:embed sql/function.sql
Function string
// Activity queries for specific PG versions
Activity = map[string]string{
"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()",
}
)