mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
don't panic on failed table creation
The attempt to set the TrackExistence option for fields happened before checking whether the field was created successfully or not. Credit to Rachith for spotting this. Bug was introduced with the TrackExistence stuff, but we apparently never had a test case for invalid min/max values.
This commit is contained in:
parent
2af417d5c2
commit
c8c88ab0ee
3 changed files with 11 additions and 4 deletions
|
|
@ -94,11 +94,11 @@ func (i *alterTableRowIter) Next(ctx context.Context) (types.Row, error) {
|
|||
fos := i.columnDef.fos
|
||||
|
||||
fld, err := pilosa.FieldFromFieldOptions(fname, fos...)
|
||||
// all newly created fields unconditionally have TrackExistence turned on.
|
||||
fld.Options.TrackExistence = true
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// all newly created fields unconditionally have TrackExistence turned on.
|
||||
fld.Options.TrackExistence = true
|
||||
|
||||
if err := i.planner.schemaAPI.CreateField(ctx, tname, fld); err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -112,11 +112,11 @@ func (i *createTableRowIter) Next(ctx context.Context) (types.Row, error) {
|
|||
|
||||
for _, f := range i.columns {
|
||||
fld, err := pilosa.FieldFromFieldOptions(dax.FieldName(f.name), f.fos...)
|
||||
// We unconditionally turn on TrackExistence for all newly-created fields.
|
||||
fld.Options.TrackExistence = true
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "creating field from field options: %s", f.name)
|
||||
}
|
||||
// We unconditionally turn on TrackExistence for all newly-created fields.
|
||||
fld.Options.TrackExistence = true
|
||||
fields = append(fields, fld)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,13 @@ var createTable = TableTest{
|
|||
),
|
||||
ExpErr: "expected literal, found bad",
|
||||
},
|
||||
{
|
||||
name: "minAboveMax",
|
||||
SQLs: sqls(
|
||||
"create table bar (_id id, i1 int min 20 max 19)",
|
||||
),
|
||||
ExpErr: "int field min cannot be greater than max",
|
||||
},
|
||||
{
|
||||
name: "commentString",
|
||||
SQLs: sqls(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue