Skip to content

Commit

Permalink
*: update the description of the foreign key (#1526)
Browse files Browse the repository at this point in the history
* *: update the description of the foreign key

* *: update the description of the foreign key

* address the comments

* address comments
  • Loading branch information
anotherrachel authored and yikeke committed Oct 12, 2019
1 parent 87554d8 commit f655f3c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
16 changes: 10 additions & 6 deletions dev/reference/sql/constraints.md
Expand Up @@ -50,13 +50,17 @@ ALTER TABLE orders DROP FOREIGN KEY fk_user_id;
ALTER TABLE orders ADD FOREIGN KEY fk_user_id (user_id) REFERENCES users(id);
```

Currently foreign keys are not enforced as part of DML operations. For example, in TiDB the following transaction commits successfully even though there is no `user_id` with `id=123`:
### Notes

```sql
START TRANSACTION;
INSERT INTO orders (user_id, doc) VALUES (123, NULL);
COMMIT;
```
* TiDB supports foreign keys so that no errors are reported for this syntax when migrating data from other databases. Currently, foreign keys are not enforced as part of DML operations. For example, even though there is no such record as `id=123` in the `users` table, the following transaction commits successfully in TiDB:

```
START TRANSACTION;
INSERT INTO orders (user_id, doc) VALUES (123, NULL);
COMMIT;
```

* In TiDB, the foreign key information is not displayed in the execution result of the `SHOW CREATE TABLE` statement.

## Not Null

Expand Down
16 changes: 10 additions & 6 deletions v2.1/reference/sql/constraints.md
Expand Up @@ -50,13 +50,17 @@ ALTER TABLE orders DROP FOREIGN KEY fk_user_id;
ALTER TABLE orders ADD FOREIGN KEY fk_user_id (user_id) REFERENCES users(id);
```

Currently foreign keys are not enforced as part of DML operations. For example, in TiDB the following transaction commits successfully even though there is no `user_id` with `id=123`:
### Notes

```sql
START TRANSACTION;
INSERT INTO orders (user_id, doc) VALUES (123, NULL);
COMMIT;
```
* TiDB supports foreign keys so that no errors are reported for this syntax when migrating data from other databases. Currently, foreign keys are not enforced as part of DML operations. For example, even though there is no such record as `id=123` in the `users` table, the following transaction commits successfully in TiDB:

```
START TRANSACTION;
INSERT INTO orders (user_id, doc) VALUES (123, NULL);
COMMIT;
```

* In TiDB, foreign key information is not displayed in the execution result of the `SHOW CREATE TABLE` statement.

## Not Null

Expand Down
16 changes: 10 additions & 6 deletions v3.0/reference/sql/constraints.md
Expand Up @@ -51,13 +51,17 @@ ALTER TABLE orders DROP FOREIGN KEY fk_user_id;
ALTER TABLE orders ADD FOREIGN KEY fk_user_id (user_id) REFERENCES users(id);
```

Currently foreign keys are not enforced as part of DML operations. For example, in TiDB the following transaction commits successfully even though there is no `user_id` with `id=123`:
### Notes

```sql
START TRANSACTION;
INSERT INTO orders (user_id, doc) VALUES (123, NULL);
COMMIT;
```
* TiDB supports foreign keys so that no errors are reported for this syntax when migrating data from other databases. Currently, foreign keys are not enforced as part of DML operations. For example, even though there is no such record as `id=123` in the `users` table, the following transaction commits successfully in TiDB:

```
START TRANSACTION;
INSERT INTO orders (user_id, doc) VALUES (123, NULL);
COMMIT;
```

* In TiDB, foreign key information is not displayed in the execution result of the `SHOW CREATE TABLE` statement.

## Not Null

Expand Down

0 comments on commit f655f3c

Please sign in to comment.