mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-06 10:57:51 +00:00
fb-2036 improve coverage for create view statement (#2333)
This commit is contained in:
parent
0e70d80030
commit
2cf972b5d1
4 changed files with 11 additions and 3 deletions
|
|
@ -594,7 +594,7 @@ func NewErrTableOrViewNotFound(line, col int, tableName string) error {
|
|||
func NewErrTableExists(line, col int, tableName string) error {
|
||||
return errors.New(
|
||||
ErrTableExists,
|
||||
fmt.Sprintf("[%d:%d] table '%s' already exists", line, col, tableName),
|
||||
fmt.Sprintf("[%d:%d] table or view '%s' already exists", line, col, tableName),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ func (i *createViewIter) Next(ctx context.Context) (types.Row, error) {
|
|||
if i.ifNotExists {
|
||||
return nil, types.ErrNoMoreRows
|
||||
}
|
||||
return nil, sql3.NewErrViewExists(0, 0, i.view.name)
|
||||
return nil, sql3.NewErrTableExists(0, 0, i.view.name)
|
||||
}
|
||||
|
||||
// now check in the views table to see if it is exists
|
||||
|
|
|
|||
|
|
@ -691,7 +691,7 @@ func TestPlanner_CreateTable(t *testing.T) {
|
|||
if err == nil {
|
||||
t.Fatal("expected error")
|
||||
} else {
|
||||
if err.Error() != "[0:0] table 'allcoltypes' already exists" {
|
||||
if err.Error() != "[0:0] table or view 'allcoltypes' already exists" {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@ var viewTests = TableTest{
|
|||
),
|
||||
),
|
||||
SQLTests: []SQLTest{
|
||||
// test for error where an table exist with the requested new view name.
|
||||
{
|
||||
name: "create-view-should-fail",
|
||||
SQLs: sqls(
|
||||
"create view viewtable as select _id, a_string, a_int from viewtable;",
|
||||
),
|
||||
ExpErr: "table or view 'viewtable' already exists",
|
||||
},
|
||||
{
|
||||
name: "create-view",
|
||||
SQLs: sqls(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue