can't UPDATE after ALTER TABLE
Created by: cryptix
Hi,
somehow I can't UPDATE
the nil values in my table after I ALTER
'ed it.
I get a index out of range
panic..
I hope you can reproduce it with these 3 steps, too.
CREATE TABLE department (Name string);
insert into department (Name) VALUES ("small"), ("large"), ("medium");
select * from department;
(work's, just for the test case)
ALTER TABLE department ADD score float;
select * from department;
(work's too, but has <nil>
's.. I'd like to have a default, the type's null value for instance)
#Output
"Name", "score"
"medium", <nil>
"large", <nil>
"small", <nil>
update department set score=0 where Name=="small";
crashes with this output:
panic: runtime error: index out of range
goroutine 16 [running]:
runtime.panic(0x8526c0, 0xd3eadc)
/mnt/fast/go/src/pkg/runtime/panic.c:279 +0xf5
github.com/cznic/ql.(*updateStmt).exec(0xc2080491c0, 0xc20803eba0, 0x0, 0x0, 0x0, 0x0)
/home/cryptix/go/src/github.com/cznic/ql/stmt.go:109 +0x1314
github.com/cznic/ql.(*DB).run1(0xc208051d50, 0xc208034950, 0xc208093908, 0x7f4e3ec46008, 0xc2080491c0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/cryptix/go/src/github.com/cznic/ql/ql.go:1970 +0x13db
github.com/cznic/ql.(*DB).Execute(0xc208051d50, 0xc208034950, 0xc208049200, 0x3, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/cryptix/go/src/github.com/cznic/ql/ql.go:1823 +0x298
main.do(0x7f4e3ec411b0, 0xc208034cc0)
/home/cryptix/go/src/github.com/cznic/ql/ql/main.go:186 +0x130d
main.main()
/home/cryptix/go/src/github.com/cznic/ql/ql/main.go:79 +0x1e
goroutine 19 [finalizer wait]:
runtime.park(0x416130, 0xd5dbb8, 0xd41809)
/mnt/fast/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0xd5dbb8, 0xd41809)
/mnt/fast/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
/mnt/fast/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
/mnt/fast/go/src/pkg/runtime/proc.c:1445