-
Notifications
You must be signed in to change notification settings - Fork 701
Add docs for information_schema.CHECK_CONSTRAINTS #14780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
22a64a7
Add cos for information_scema.CHECK_CONSTRAINTS
dveeden 9d9fda0
Update achor name
dveeden fdbeb1a
Apply suggestions from code review
dveeden 0bbc290
update
dveeden 07159bd
Update information-schema/information-schema-check-constraints.md
dveeden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
information-schema/information-schema-check-constraints.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
title: CHECK_CONSTRAINTS | ||
summary: Learn the `CHECK_CONSTRAINTS` INFORMATION_SCHEMA table. | ||
--- | ||
|
||
# CHECK\_CONSTRAINTS | ||
|
||
The `CHECK_CONSTRAINTS` table provides information about [`CHECK` constraints](/constraints.md#check) on tables. | ||
|
||
```sql | ||
USE INFORMATION_SCHEMA; | ||
DESC CHECK_CONSTRAINTS; | ||
``` | ||
|
||
The output is as follows: | ||
|
||
```sql | ||
+--------------------+-------------+------+-----+---------+-------+ | ||
| Field | Type | Null | Key | Default | Extra | | ||
+--------------------+-------------+------+-----+---------+-------+ | ||
| CONSTRAINT_CATALOG | varchar(64) | NO | | NULL | | | ||
| CONSTRAINT_SCHEMA | varchar(64) | NO | | NULL | | | ||
| CONSTRAINT_NAME | varchar(64) | NO | | NULL | | | ||
| CHECK_CLAUSE | longtext | NO | | NULL | | | ||
+--------------------+-------------+------+-----+---------+-------+ | ||
4 rows in set (0.00 sec) | ||
``` | ||
|
||
The following example adds a `CHECK` constraint using the `CREATE TABLE` statement: | ||
|
||
```sql | ||
CREATE TABLE test.t1 (id INT PRIMARY KEY, CHECK (id%2 = 0)); | ||
SELECT * FROM CHECK_CONSTRAINTS\G | ||
``` | ||
|
||
The output is as follows: | ||
|
||
```sql | ||
*************************** 1. row *************************** | ||
CONSTRAINT_CATALOG: def | ||
CONSTRAINT_SCHEMA: test | ||
CONSTRAINT_NAME: t1_chk_1 | ||
CHECK_CLAUSE: (`id` % 2 = 0) | ||
1 row in set (0.00 sec) | ||
``` | ||
dveeden marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Fields in the `CHECK_CONSTRAINTS` table are described as follows: | ||
|
||
* `CONSTRAINT_CATALOG`: The catalog of the constraint, which is always `def`. | ||
* `CONSTRAINT_SCHEMA`: The schema of the constraint. | ||
* `CONSTRAINT_NAME`: The name of the constraint. | ||
* `CHECK_CLAUSE`: The clause of the check constraint. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.