Would dropping the non-functioning default clause from the schema be a
"breaking change"?
That is from:
# sqlite3 dummy.db
sqlite> CREATE TABLE x(
...> id INTEGER PRIMARY KEY DEFAULT (random()),
...> val VARCHAR
...> );
sqlite> .schema
CREATE TABLE x(
*id INTEGER PRIMARY KEY DEFAULT (random()),*
val VARCHAR
);
to:
# sqlite3 dummy.db
sqlite> CREATE TABLE x(
...> id INTEGER PRIMARY KEY DEFAULT (random()),
...> val VARCHAR
...> );
sqlite> .schema
CREATE TABLE x(
*id INTEGER PRIMARY KEY*,
val VARCHAR
);
And would it be better, or cause more head-scratching, I dunno...
John
On Thu, Sep 25, 2014 at 4:07 PM, Richard Hipp <[email protected]> wrote:
> On Thu, Sep 25, 2014 at 4:46 PM, Mark Lawrence <[email protected]> wrote:
>
> >
> > If you are going to keep this behaviour would it not make more sense to
> > ensure that the table creation fails? The DEFAULT clause is pretty
> > straight-forward and I don't find it intuitive to go looking for
> > PRIMARY KEY documentation when it is ignored.
> >
> > SQLite should either fail to accept the statement or do what the table
> > definition says - anything else means heartache for those debugging
> > problems (which I did for hours on this issue) and those reading the
> > code afterwards.
> >
>
> That would break backwards compatibility for the millions and millions of
> applications currently using SQLite. Most of those millions would be
> unaffected, no doubt, but out of millions I'm sure there are a goodly
> number that would break. I am unwilling to implement a breaking change
> simply to make the interface more "intuitive".
>
> Had you brought this up in 2002, the outcome would likely have been very
> different. But at this point, the behavior of INTEGER PRIMARY KEY in
> SQLite is not something that can be modified.
>
> Sorry to disappoint.
> --
> D. Richard Hipp
> [email protected]
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users