Michael Schlenker <msc-ynu+nt5fez2elga04la...@public.gmane.org> writes:
> Hi all,
>
> Have a look at the following short sqlite shell session:
>
> SQLite version 3.6.4
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> create table foo (a text(5) NOT NULL);
> sqlite> alter table foo add column b text(5) NOT NULL;
> SQL error: Cannot add a NOT NULL column with default value NULL
>
> Is there a reason for this asymetric behaviour of ALTER TABLE and CREATE
> TABLE?

What values do you want the existing rows to have in the new column when
you declare it as NOT NULL? You have to specify that, otherwise SQLite
doesn't know what to do.


Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to