On 04/26/2014 05:23 AM, Hinrichsen, John wrote:
Default non-NULL values copied from a column that was added using "ALTER
TABLE ... ADD COLUMN ... DEFAULT ..." are inserted into another table as
NULLs when copied using "INSERT INTO ... SELECT * FROM ..."
However, the same values are propagated correctly when "CREATE TABLE ... AS
SELECT * FROM ..." is executed.
See example below:
$ sqlite3
SQLite version 3.8.4.3 2014-04-03 16:53:12
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .header on
sqlite> .mode column
sqlite> CREATE TABLE a(a);
sqlite> INSERT INTO a VALUES(1);
sqlite>
sqlite> ALTER TABLE a ADD COLUMN b DEFAULT 2;
sqlite>
sqlite> CREATE TABLE b AS SELECT * FROM a;
sqlite> INSERT INTO b SELECT * FROM a;
sqlite>
sqlite> SELECT * FROM a;
a b
---------- ----------
1 2
sqlite> SELECT * FROM b;
a b
---------- ----------
1 2
1
sqlite>
Thanks for reporting this. Now fixed on the trunk. Ticket is here:
http://www.sqlite.org/src/info/f67b41381acce9a881fb081c4a20ecbeb2429b0d
Dan.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users