You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/doltgres/content/concepts/sql/constraints.md
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -6,17 +6,17 @@ title: Constraints
6
6
7
7
## What is a Constraint?
8
8
9
-
Constraints restrict the values allowed in a column. There are multiple forms of constraints:
9
+
Constraints restrict the values allowed in a column. There are multiple forms of constraints:
10
10
11
11
1.`NOT NULL` or `UNIQUE` in the column definition
12
12
2. Check constraints
13
13
3. Foreign Key constraints
14
14
15
15
Simple constraints like `NOT NULL` and `UNIQUE` can be added when defining a column. These constrain the column to not be NULL and only contain unique values, respectively.
16
16
17
-
Check constraints allow the database user to define more complex constraints, like ranges on numerical values.
17
+
Check constraints allow the database user to define more complex constraints, like ranges on numerical values.
18
18
19
-
Foreign key constraints allow you to reference and define relations between other tables in your database.
19
+
Foreign key constraints allow you to reference and define relations between other tables in your database.
20
20
21
21
## How to use Constraints
22
22
@@ -26,9 +26,9 @@ database.
26
26
27
27
You can add constraints when running `CREATE TABLE` statements or add them to existing tables using `ALTER` statements.
28
28
29
-
## Difference between MySQL Constraints and Doltgres Constraints
29
+
## Difference between Postgres Constraints and Doltgres Constraints
30
30
31
-
MySQL and Doltgres constraints are functionally equivalent.
31
+
Postgres and Doltgres constraints are functionally equivalent.
| admin | Grants all permissions available. In addition, grants write access to entries on both system tables, as long as the database and branch are equivalent, or they're subset of the database + branch that this permission belongs to. |
45
45
| write | Grants the ability to write on the branch, as well as modify the branch in all possible ways (rename, delete, etc.). |
46
46
| read | Does not explicitly grant any permissions, as having the ability to read a branch is an irrevocable right for all users. This is just for the visual convenience, versus having an empty field. |
@@ -54,8 +54,8 @@ The form of pattern matching that each column implements is very similar to how
54
54
Most characters are interpreted as-is, with the exception of three characters.
|\_| Matches a single character, regardless of what that character is. |
59
59
| % | Matches zero or more characters, regardless of what those characters are. |
60
60
|\| Escapes the next character, allowing it to be compared literally. This is only useful when attempting to match one of these special characters, as it is otherwise ignored (has no effect). |
61
61
@@ -93,7 +93,7 @@ The modification of both system tables are controlled by two entities: the privi
93
93
Any user that satisfies the privilege requirements may edit the appropriate entries in both system tables.
|`*.*`| SUPER, GRANT OPTION | Considered a global admin. May edit any entry in either table, including entries containing special characters. |
98
98
|`*.*`| CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, EXECUTE, GRANT OPTION | Same as above. |
99
99
|`database.*`| CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, EXECUTE, GRANT OPTION | Considered a database admin. May edit entries only for their specific database. This also excludes all databases that contain _any_ special characters. |
@@ -152,9 +152,11 @@ It is worth noting that operations such as renaming a branch also require the co
152
152
This is because a rename may be viewed as a copy and delete, therefore it is modifying the original branch.
153
153
154
154
To turn `dolt_branch_namespace_control` into a blacklist (just like `dolt_branch_control`), then run the following statement:
155
+
155
156
```sql
156
157
INSERT INTO dolt_branch_namespace_control VALUES ('%', '%', '', '');
157
158
```
159
+
158
160
This will add an entry that will match every possible branch, but will never match a user as a user will never have an empty user and host.
159
161
Due to the longest match rule, this entry will be ignored when a valid match is found.
160
162
@@ -175,8 +177,8 @@ The following examples are a small snippet that shows branch permissions in acti
175
177
It is assumed that this document has been read in full, as concepts that are explained in previous sections are not explained in-depth.
176
178
The [setup section](#setup) is run before each example, therefore remember to have a dedicated terminal window for [setup](#setup) if you want to try any of these examples yourself.
177
179
All examples other than [setup](#setup) will exclusively use the second terminal window.
178
-
All examples will use MySQL's default client, `mysql`.
179
-
Feel free to use your desired MySQL client.
180
+
All examples will use Postgres' default client, `psql`.
0 commit comments