On 25 Nov 2019, at 11:02am, Jaroslav Homisin <jaroslav.homi...@xplm.com> wrote:

> I have expected a list of the two constraints: of Primary key and of Unique. 
> But I can find only Primary Key Constraint.

Where are you getting your list of constraints from ?

SQLite version 3.28.0 2019-04-15 14:49:49
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE XRelations (
   ...>   XRID INTEGER PRIMARY KEY AUTOINCREMENT  NOT NULL , 
   ...>     XID1 TEXT (100) NOT NULL , 
   ...>     XID2 TEXT (100) NOT NULL , 
   ...>     RelationType TEXT (100) NULL , 
   ...>     CONSTRAINT unq UNIQUE ( XID1, XID2)
   ...> );
sqlite> INSERT INTO XRelations VALUES (1,'a','n','first');
sqlite> INSERT INTO XRelations VALUES (2,'a','n','first');
Error: UNIQUE constraint failed: XRelations.XID1, XRelations.XID2
sqlite> INSERT INTO XRelations VALUES (1,'b','m','first');
Error: UNIQUE constraint failed: XRelations.XRID
sqlite> .mode column
sqlite> PRAGMA index_list('XRelations');
0           sqlite_autoindex_XRelations_1  1           u           0 
sqlite> PRAGMA index_info('sqlite_autoindex_XRelations_1');
0           1           XID1      
1           2           XID2     
sqlite> PRAGMA index_xinfo('sqlite_autoindex_XRelations_1');
0           1           XID1        0           BINARY      1         
1           2           XID2        0           BINARY      1         
2           -1                      0           BINARY      0         

This shows details of the index automatically made by SQLite so it can quickly 
find violations of CONSTRAINT unq .
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to