From f5a0739985e3f3412de3dc883807fe432a3f9bb1 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sat, 28 Apr 2018 22:08:34 +0100 Subject: [PATCH] Add foreign table information to SQL INFO query --- db/info.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/db/info.go b/db/info.go index 23a91309..f607aa42 100644 --- a/db/info.go +++ b/db/info.go @@ -153,6 +153,11 @@ func (e *executor) executeInfoTB(ctx context.Context, ast *sql.InfoStatement) (o return nil, err } + ft, err := e.dbo.AllFT(ast.NS, ast.DB, ast.What.TB) + if err != nil { + return nil, err + } + res := data.New() event := make(map[string]interface{}) @@ -175,10 +180,16 @@ func (e *executor) executeInfoTB(ctx context.Context, ast *sql.InfoStatement) (o lives[v.ID] = v.String() } + table := make(map[string]interface{}) + for _, v := range ft { + table[v.Name.ID] = v.String() + } + res.Set(event, "event") res.Set(field, "field") res.Set(index, "index") res.Set(lives, "lives") + res.Set(table, "table") return []interface{}{res.Data()}, nil