Skip to content

Instantly share code, notes, and snippets.

@kazeburo
Created January 13, 2015 04:47
Show Gist options
  • Save kazeburo/333474397f3ce91abf79 to your computer and use it in GitHub Desktop.
Save kazeburo/333474397f3ce91abf79 to your computer and use it in GitHub Desktop.
mysql>CREATE TABLE articles (
-> id int unsigned not null auto_increment,
-> blog_id int,
-> article_id int,
-> pbody mediumtext,
-> primary key(id),
-> unique key (blog_id, article_id),
-> fulltext key (pbody)
-> ) engine = mroonga default charset = utf8;
Query OK, 0 rows affected (0.81 sec)
mysql>INSERT INTO articles (blog_id,article_id,pbody) VALUES (1, 100,"foo bar bas");
Query OK, 1 row affected (0.40 sec)
mysql>INSERT INTO articles (blog_id,article_id,pbody) VALUES (1, 100,"foo bar bas");
ERROR 1062 (23000): Duplicate entry '1-100' for key 'blog_id'
mysql>UPDATE articles SET pbody="foo bar bbbbbzzz" where blog_id=1 and article_id=100;
Query OK, 0 rows affected (0.11 sec)
Rows matched: 0 Changed: 0 Warnings: 0
この時点でおかしい?
mysql>INSERT INTO articles (blog_id,article_id,pbody) VALUES (2, 100,"foo bar bas");
Query OK, 1 row affected (0.15 sec)
mysql>select * from articles where blog_id=1 and article_id=100;
Empty set (0.05 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment