MCPcopy
hub / github.com/pingcap/tidb / appendColNamesToVisitInfo

Method appendColNamesToVisitInfo

pkg/planner/core/expression_rewriter.go:2760–2796  ·  view source on GitHub ↗
(columnVisited []*ast.ColumnName)

Source from the content-addressed store, hash-verified

2758}
2759
2760func (b *PlanBuilder) appendColNamesToVisitInfo(columnVisited []*ast.ColumnName) {
2761 user, host := auth.GetUserAndHostName(b.ctx.GetSessionVars().User)
2762 views := b.SavedViews
2763 switch {
2764 case len(views) > 0:
2765 view := views[len(views)-1]
2766 for _, colName := range columnVisited {
2767 b.visitInfo = appendVisitInfo(b.visitInfo,
2768 mysql.SelectPriv,
2769 colName.Schema.L,
2770 colName.Table.L,
2771 colName.Name.L,
2772 plannererrors.ErrViewInvalid.GenWithStackByArgs(view.Schema.O, view.Name.O),
2773 )
2774 }
2775 case b.checkColPriv == reportTableErrOption:
2776 for _, colName := range columnVisited {
2777 b.visitInfo = appendVisitInfo(b.visitInfo,
2778 mysql.SelectPriv,
2779 colName.Schema.L,
2780 colName.Table.L,
2781 colName.Name.L,
2782 plannererrors.ErrTableaccessDenied.FastGenByArgs("SELECT", user, host, colName.Table.L),
2783 )
2784 }
2785 default:
2786 for _, colName := range columnVisited {
2787 b.visitInfo = appendVisitInfo(b.visitInfo,
2788 mysql.SelectPriv,
2789 colName.Schema.L,
2790 colName.Table.L,
2791 colName.Name.L,
2792 plannererrors.ErrColumnaccessDenied.FastGenByArgs("SELECT", user, host, colName.Name.L, colName.Table.L),
2793 )
2794 }
2795 }
2796}
2797
2798func (er *expressionRewriter) precollectColNames(fieldName *types.FieldName) {
2799 colName := &ast.ColumnName{

Callers 2

coalesceCommonColumnsMethod · 0.95
rewriteExprNodeFunction · 0.80

Calls 3

GetUserAndHostNameFunction · 0.92
appendVisitInfoFunction · 0.85
GetSessionVarsMethod · 0.65

Tested by

no test coverage detected