Skip to content

Commit

Permalink
Add pg_stat_gssapi table support
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunlol committed Dec 16, 2024
1 parent c2bbb12 commit 527bf5e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/query_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ func TestHandleQuery(t *testing.T) {
"description": {"oid", "datname", "datdba"},
"values": {"1146", "memory", ""},
},
"SELECT * FROM pg_catalog.pg_stat_gssapi": {
"description": {"pid", "gss_authenticated", "principal", "encrypted", "credentials_delegated"},
"values": {},
},
// pg_namespace
"SELECT DISTINCT(nspname) FROM pg_catalog.pg_namespace WHERE nspname != 'information_schema' AND nspname != 'pg_catalog'": {
"description": {"nspname"},
Expand Down
13 changes: 13 additions & 0 deletions src/select_remapper_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const (
PG_TABLE_PG_EXTENSION = "pg_extension"
PG_TABLE_PG_REPLICATION_SLOTS = "pg_replication_slots"
PG_TABLE_PG_DATABASE = "pg_database"
PG_TABLE_PG_STAT_GSSAPI = "pg_stat_gssapi"

PG_TABLE_TABLES = "tables"
)
Expand Down Expand Up @@ -86,6 +87,10 @@ func (remapper *SelectRemapperTable) RemapTable(node *pgQuery.Node) *pgQuery.Nod
// pg_catalog.pg_database -> extend with additional Postgres columns
tableNode := parser.MakePgDatabaseNode(qSchemaTable.Alias)
return remapper.overrideTable(node, tableNode)
case PG_TABLE_PG_STAT_GSSAPI:
// pg_catalog.pg_stat_gssapi -> return nothing
tableNode := parser.MakeEmptyTableNode(PG_STAT_GSSAPI_COLUMNS, qSchemaTable.Alias)
return remapper.overrideTable(node, tableNode)
default:
// pg_catalog.pg_* other system tables -> return as is
return node
Expand Down Expand Up @@ -217,3 +222,11 @@ var PG_REPLICATION_SLOTS_COLUMNS = []string{
"two_phase",
"conflicting",
}

var PG_STAT_GSSAPI_COLUMNS = []string{
"pid",
"gss_authenticated",
"principal",
"encrypted",
"credentials_delegated",
}

0 comments on commit 527bf5e

Please sign in to comment.