SQLite Forum

ALTER TABLE DROP COLUMN corrupts data
Login
```sql
CREATE TABLE [MyTable] (
[ID] INTEGER PRIMARY KEY NOT NULL,
[Foo] INTEGER,
[Bar] INTEGER);

-- Insert 50000 identical rows
INSERT INTO [MyTable] ([Foo], [Bar])
SELECT 123, 456 FROM generate_series(1, 50000, 1);
-- All rows are: [Foo]==123, [Bar]==456

-- Drop the [Foo] column
ALTER TABLE [MyTable] DROP COLUMN [Foo];
-- All rows should be: [Bar]==456

-- However, mysteriously, some rows now have [Bar]==123 :

SELECT COUNT(*) FROM [MyTable] WHERE [Bar]=123  -- (Prints 17226 for me)
```