summaryrefslogtreecommitdiffstats
path: root/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_insert_existent.result
blob: ddc54cb3f9e3fda10968fbe7f0900b66210c19c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
DROP DATABASE test;
CREATE DATABASE test;
USE test;
CREATE TABLE comments (
id int unsigned PRIMARY KEY,
content varchar(140) NOT NULL
);
CREATE TABLE entries (
content varchar(140) NOT NULL,
comment_id int unsigned,
FOREIGN KEY (comment_id) REFERENCES comments (id)
);
INSERT INTO comments (id, content) VALUES (100, 'Good entry!');
INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100);
SELECT * FROM entries;
content	comment_id
Hello!	100
SELECT * FROM comments;
id	content
100	Good entry!
SELECT mroonga_command('dump --dump_plugins no');
mroonga_command('dump --dump_plugins no')
table_create comments TABLE_PAT_KEY UInt32
column_create comments content COLUMN_SCALAR ShortText
column_create comments id COLUMN_SCALAR UInt32

table_create entries TABLE_NO_KEY
column_create entries content COLUMN_SCALAR ShortText

table_create mroonga_operations TABLE_NO_KEY
column_create mroonga_operations record COLUMN_SCALAR UInt32
column_create mroonga_operations table COLUMN_SCALAR ShortText
column_create mroonga_operations type COLUMN_SCALAR ShortText

column_create entries comment_id COLUMN_SCALAR comments

load --table comments
[
["_key","content","id"],
[100,"Good entry!",100]
]

load --table entries
[
["_id","comment_id","content"],
[1,100,"Hello!"]
]

column_create comments entries-comment_id----------------------------------------------- COLUMN_INDEX entries comment_id
DROP TABLE entries;
DROP TABLE comments;