On Thu, 08 May 2014 13:15:54 +0300, Constantine Yannakopoulos wrote:
 most if not all other databases do not implement this

$ psql
psql (9.3.4)
Type "help" for help.

misc=# create table parent
misc-# (a_id varchar(1),
misc(#  constraint pk_parent primary key(a_id));
CREATE TABLE
misc=# create table child
misc-# (b_id varchar(1),
misc(#  a_id varchar(1),
misc(#  constraint fk_child_parent foreign key
misc(#  (a_id) references parent);
CREATE TABLE
misc=# insert into parent values ('a');
INSERT 0 1
misc=# insert into child values ('1','a');
INSERT 0 1
misc=# insert into child values ('2','a');
INSERT 0 1
misc=# insert into child values ('1','b');
ERROR:  insert or update on table "child" violates foreign key constraint 
"fk_child_parent"
DETAIL:  Key (a_id)=(b) is not present in table "parent".
misc=#


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to