Skip to content

Commit

Permalink
Handle view define issue (matrixorigin#12453)
Browse files Browse the repository at this point in the history
Bugs in handling view definitions

Approved by: @ouyuanning, @heni02
  • Loading branch information
qingxinhome authored Nov 1, 2023
1 parent 59603f5 commit b3da04e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/sql/plan/base_binder.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (b *baseBinder) baseBindColRef(astExpr *tree.UnresolvedName, depth int32, i
if binding != nil {
relPos = binding.tag
colPos = binding.colIdByName[col]
typ = binding.types[colPos]
typ = DeepCopyType(binding.types[colPos])
table = binding.table
} else {
return nil, moerr.NewInvalidInput(b.GetContext(), "ambiguous column reference '%v'", name)
Expand All @@ -329,7 +329,7 @@ func (b *baseBinder) baseBindColRef(astExpr *tree.UnresolvedName, depth int32, i
return nil, moerr.NewInvalidInput(b.GetContext(), "ambiguous column reference '%v'", name)
}
if colPos != NotFound {
typ = binding.types[colPos]
typ = DeepCopyType(binding.types[colPos])
relPos = binding.tag
} else {
err = moerr.NewInvalidInput(localErrCtx, "column '%s' does not exist", name)
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/plan/bind_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (bc *BindContext) addUsingCol(col string, typ plan.Node_JoinType, left, rig
rightPos := rightBinding.colIdByName[col]
expr, err := bindFuncExprImplByPlanExpr(bc.binder.GetContext(), "=", []*plan.Expr{
{
Typ: leftBinding.types[leftPos],
Typ: DeepCopyType(leftBinding.types[leftPos]),
Expr: &plan.Expr_Col{
Col: &plan.ColRef{
RelPos: leftBinding.tag,
Expand All @@ -178,7 +178,7 @@ func (bc *BindContext) addUsingCol(col string, typ plan.Node_JoinType, left, rig
},
},
{
Typ: rightBinding.types[rightPos],
Typ: DeepCopyType(rightBinding.types[rightPos]),
Expr: &plan.Expr_Col{
Col: &plan.ColRef{
RelPos: rightBinding.tag,
Expand Down
2 changes: 0 additions & 2 deletions test/distributed/cases/database/system_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ show columns from `KEY_COLUMN_USAGE`;
show columns from `COLUMNS`;
show columns from `PROFILING`;
show columns from `USER_PRIVILEGES`;
-- @bvt:issue#12196
show columns from `SCHEMATA`;
-- @bvt:issue
show columns from `CHARACTER_SETS`;
show columns from `TRIGGERS`;
show columns from `TABLES`;
Expand Down
2 changes: 1 addition & 1 deletion test/distributed/cases/database/system_variables.result
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ grantee table_catalog
desc schemata;
Field Type Null Key Default Extra Comment
catalog_name VARCHAR(5000) YES null
schema_name VARCHAR(5000) NO null
schema_name VARCHAR(5000) YES null
default_character_set_name VARCHAR(7) NO null
default_collation_name VARCHAR(18) NO null
sql_path VARCHAR(0) YES null
Expand Down

0 comments on commit b3da04e

Please sign in to comment.