Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread J. King
On February 13, 2019 5:47:09 PM EST, Thomas Kurz wrote: >I don't think so because this works (shortened here; it also works with >REFERENCES...): > >ALTER TABLE test ADD COLUMN groupid2 INTEGER NOT NULL DEFAULT 1; You're correct; I must have been confusing the prohibition on CURRENT_TIMESTAMP

Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread Keith Medcalf
>boun...@mailinglists.sqlite.org] On Behalf Of Thomas Kurz >Sent: Wednesday, 13 February, 2019 15:32 >To: SQLite mailing list >Subject: [sqlite] inconsistent behavior when creating INTEGER NOT >NULL column without DEFAULT? > >I just stumbled upon the following issue (tested with 3.27.1)

Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread Graham Holden
On Wednesday, February 13, 2019, 11:06:07 PM, Thomas Kurz wrote: >> I guess a missing DEFAULT automatically implies DEFAULT NULL, so >> the behavior of ALTER should be correct whilst CREATE seems to >> forget to reject the statement. I suspect the difference is you can CREATE a NOT NULL column

Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread Thomas Kurz
> I guess a missing DEFAULT automatically implies DEFAULT NULL, so the behavior > of ALTER should be correct whilst CREATE seems to forget to reject the > statement. Sorry, I was wrong about this. The CREATE shows the correct behavior whereas ALTER incorrecty rejects the statement. According

Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread Thomas Kurz
> This is a limitation of SQLite's current ALTER TABLE implementation. Columns > can only be added with a default value of NULL, therefore NOT NULL columns > are forbidden. I don't think so because this works (shortened here; it also works with REFERENCES...): ALTER TABLE test ADD COLUMN

Re: [sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread J. King
On February 13, 2019 5:32:09 PM EST, Thomas Kurz wrote: >I just stumbled upon the following issue (tested with 3.27.1): > >I can do this: >CREATE TABLE test (groupid INTEGER NOT NULL REFERENCES mygroup (id) ON >UPDATE CASCADE ON DELETE CASCADE); > >But this fails: >ALTER TABLE test ADD COLUMN

[sqlite] inconsistent behavior when creating INTEGER NOT NULL column without DEFAULT?

2019-02-13 Thread Thomas Kurz
I just stumbled upon the following issue (tested with 3.27.1): I can do this: CREATE TABLE test (groupid INTEGER NOT NULL REFERENCES mygroup (id) ON UPDATE CASCADE ON DELETE CASCADE); But this fails: ALTER TABLE test ADD COLUMN groupid2 INTEGER NOT NULL REFERENCES mygroup (id) ON UPDATE