+1 on my part

On Sun, Aug 14, 2016 at 9:59 AM, Василий Кудрявцев <vkl...@yandex.ru> wrote:
> Hi!
>
>
>
> I would like to propose an enhancement to SQLite diagnostics in case of
> unique constraint failure.
>
> Currently the message does not contain the name of constraint in question,
> only columns. For example:
>
>
>
> sqlite> CREATE TABLE c_test (c0 INTEGER, c1 INTEGER, c2 INTEGER, CONSTRAINT
> U_X1 UNIQUE(c0, c2), CONSTRAINT U_X2 UNIQUE(c1, c2) );
>
> sqlite> INSERT  INTO c_test VALUES (1, 1, 1);
>
> sqlite> INSERT  INTO c_test VALUES (2, 1, 1);
>
> Error: UNIQUE constraint failed: c_test.c1, c_test.c2
>
> sqlite> INSERT  INTO c_test VALUES (1, 2, 1);
>
> Error: UNIQUE constraint failed: c_test.c0, c_test.c2
>
>
>
> It is much more convenient in CHECK constraints:
>
>
>
> CREATE TABLE test (id INTEGER, CONSTRAINT U_X UNIQUE(id), CONSTRAINT C_X
> CHECK (id < 5));
>
> sqlite> INSERT  INTO test VALUES (7);
>
> Error: CHECK constraint failed: C_X
>
>
>
>
>
> The CHECK constraint name is included in the message and can easiliy be
> extracted.
>
>
>
> It seems to me that adding similar behavior to unique constraints will be
> beneficial, and, looking into the source code, not hard to implement.
>
>
>
> Vasiliy
>
>
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to