Skip to content

Commit 4c25225

Browse files
authored
Merge pull request #2409 from dolthub/taylor/dg-sys-tables
Restructure doltgres system table docs
2 parents e0310e5 + 6ae22ca commit 4c25225

File tree

3 files changed

+669
-536
lines changed

3 files changed

+669
-536
lines changed

Diff for: packages/dolt/content/reference/sql/version-control/dolt-system-tables.md

+30-27
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ guaranteed to see these changes reflected in the files on disk.
153153
+----------+------+
154154
```
155155

156+
### Example
157+
158+
Gets all docs.
159+
160+
{% embed url="https://www.dolthub.com/repositories/dolthub/first-hour-db/embed/main?q=select+*+from+dolt_docs%3B" %}
161+
156162
## `dolt_procedures`
157163

158164
`dolt_procedures` stores each stored procedure that has been created
@@ -386,25 +392,22 @@ commit graph and is not subject to versioning semantics.
386392
+-----------------+----------+------+-----+---------+-------+
387393
| Field | Type | Null | Key | Default | Extra |
388394
+-----------------+----------+------+-----+---------+-------+
389-
| database | text | NO | PRI | NULL | |
390-
| table | text | NO | PRI | NULL | |
391-
| index | text | NO | PRI | NULL | |
392-
| position | bigint | NO | PRI | NULL | |
393-
| version | bigint | NO | | NULL | |
394-
| commit_hash | text | NO | | NULL | |
395+
| database_name | text | NO | PRI | NULL | |
396+
| table_name | text | NO | PRI | NULL | |
397+
| index_name | text | NO | PRI | NULL | |
395398
| row_count | bigint | NO | | NULL | |
396399
| distinct_count | bigint | NO | | NULL | |
397400
| null_count | bigint | NO | | NULL | |
398-
| columns | json | NO | | NULL | |
399-
| types | json | NO | | NULL | |
400-
| upper_bound | json | NO | | NULL | |
401+
| columns | text | NO | | NULL | |
402+
| types | text | NO | | NULL | |
403+
| upper_bound | text | NO | | NULL | |
401404
| upper_bound_cnt | bigint | NO | | NULL | |
402405
| created_at | datetime | NO | | NULL | |
403-
| mcv1 | json | NO | | NULL | |
404-
| mcv2 | json | NO | | NULL | |
405-
| mcv3 | json | NO | | NULL | |
406-
| mcv4 | json | NO | | NULL | |
407-
| mcvCounts | json | NO | | NULL | |
406+
| mcv1 | text | NO | | NULL | |
407+
| mcv2 | text | NO | | NULL | |
408+
| mcv3 | text | NO | | NULL | |
409+
| mcv4 | text | NO | | NULL | |
410+
| mcvCounts | text | NO | | NULL | |
408411
+-----------------+----------+------+-----+---------+-------+
409412
```
410413
@@ -906,7 +909,7 @@ num_inmates_rated_for have changed the most between 2 versions.
906909
907910
## `dolt_conflicts`
908911
909-
dolt_conflicts is a system table that has a row for every table in the working set that has an unresolved merge
912+
`dolt_conflicts` is a system table that has a row for every table in the working set that has an unresolved merge
910913
conflict.
911914
912915
```sql
@@ -985,18 +988,18 @@ And of course you can use any combination of `ours`, `theirs` and
985988
primary key (or keyless hash). If the row does not exist, it will be inserted.
986989
Updates made to `our_` columns will never delete a row, however.
987990
988-
- `dolt_conflict_id` is a unique identifier for the conflict. It is particulary
991+
- `dolt_conflict_id` is a unique identifier for the conflict. It is particularly
989992
useful when writing software that needs to resolve conflicts automatically.
990993
991994
- `from_root_ish` is the commit hash of the "from branch" of the merge. This
992995
hash can be used to identify which merge produced a conflict, since conflicts
993-
can accumalate across merges.
996+
can accumulate across merges.
994997
995998
{% endhint %}
996999
9971000
## `dolt_schema_conflicts`
9981001
999-
dolt_schema_conflicts is a system table that has a row for every table in the working
1002+
`dolt_schema_conflicts` is a system table that has a row for every table in the working
10001003
set that has an unresolved schema conflict.
10011004
10021005
```sql
@@ -1020,19 +1023,19 @@ resolving schema conflicts during merge, see the docs on [conflicts](./merges.md
10201023
10211024
## `dolt_merge_status`
10221025
1023-
The dolt_merge_status system table tells a user if a merge is active. It has the following schema:
1026+
The `dolt_merge_status` system table tells a user if a merge is active. It has the following schema:
10241027
10251028
```sql
10261029
CREATE TABLE `dolt_merge_status` (
1027-
-- Whether a merge is currently active or not
1030+
-- Whether a merge is currently active or not
10281031
`is_merging` tinyint NOT NULL,
1029-
-- The commit spec that was used to initiate the merge
1032+
-- The commit spec that was used to initiate the merge
10301033
`source` text,
1031-
-- The commit that the commit spec resolved to at the time of merge
1034+
-- The commit that the commit spec resolved to at the time of merge
10321035
`source_commit` text,
1033-
-- The target destination working set
1036+
-- The target destination working set
10341037
`target` text,
1035-
-- A list of tables that have conflicts or constraint violations
1038+
-- A list of tables that have conflicts or constraint violations
10361039
`unmerged_tables` text
10371040
)
10381041
```
@@ -1115,13 +1118,13 @@ These tables can be modified in order to update what changes are staged for comm
11151118
11161119
### Schema
11171120
1118-
The schema of the source table is going to effect the schema of the workspace table. The first
1121+
The schema of the source table is going to affect the schema of the workspace table. The first
11191122
three column are always the same, then the schema of the source table is used to create "to\_" and
11201123
"from\_" columns.
11211124
11221125
Each row in the `dolt_workspace_$TABLENAME` corresponds to a single row update in the table.
11231126
1124-
```text
1127+
```sql
11251128
+------------------+----------+
11261129
| field | type |
11271130
+------------------+----------+
@@ -1156,7 +1159,7 @@ FROM dolt_workspace_mytable
11561159
WHERE staged=false
11571160
```
11581161
1159-
```text
1162+
```sql
11601163
+----+--------+-----------+-------+----------+---------+------------+
11611164
| id | staged | diff_type | to_id | to_value | from_id | from_value |
11621165
+----+--------+-----------+-------+----------+---------+------------+

Diff for: packages/doltgres/content/reference/sql/version-control/dolt-sql-procedures.md

+23-24
Original file line numberDiff line numberDiff line change
@@ -1066,27 +1066,26 @@ select dolt_commit('-am', 'inserting row 3');
10661066

10671067
-- check out what our commit history on branch1 looks like before we rebase
10681068
select commit_hash, message from dolt_log;
1069-
+----------------------------------+----------------------------+
1070-
| commit_hash | message |
1071-
+----------------------------------+----------------------------+
1072-
| tsq01op7b48ij6dfa2tst60vbfm9rcus | inserting row 3 |
1073-
| uou7dibe86e9939pu8fdtjdce5pt7v1c | inserting row 2 |
1074-
| 3umkjmqeeep5ho7nn0iggfinajoo1l6q | inserting row 1 |
1075-
| 35gfll6o322aq9uffdqin1dqmq7q3vek | creating table t |
1076-
| do1tp9u39vsja3c8umshv9p6fernr0lt | Inіtіalizе dаta repоsitоry |
1077-
+----------------------------------+----------------------------+
1069+
commit_hash | message
1070+
----------------------------------+----------------------------
1071+
m2v3oajs9jesvvc44ihqlsu1uq2c8jf2 | inserting row 3
1072+
qa1t5ieqs418s1b7mssqlmpn68ackq20 | inserting row 2
1073+
tgltn67jjho1mp8a3jdl3jkip08jbbun | inserting row 1
1074+
nof0lk6ufv031mddiahqfqfelqcpjdv5 | creating table t
1075+
pfjaqljdrdn43877sbc2d2sla9g3eb8u | CREATE DATABASE
1076+
k23mej9jdej41s0n7o2g8gp5rpgvrfdb | Initialize data repository
1077+
(6 rows)
10781078

10791079
-- start an interactive rebase and check out the default rebase plan; this will rebase
10801080
-- all the new commits on this branch and move them to the tip of the main branch
10811081
select dolt_rebase('-i', 'main');
10821082
select * from dolt_rebase order by rebase_order;
1083-
+--------------+--------+----------------------------------+-----------------+
1084-
| rebase_order | action | commit_hash | commit_message |
1085-
+--------------+--------+----------------------------------+-----------------+
1086-
| 1.00 | pick | 3umkjmqeeep5ho7nn0iggfinajoo1l6q | inserting row 1 |
1087-
| 2.00 | pick | uou7dibe86e9939pu8fdtjdce5pt7v1c | inserting row 2 |
1088-
| 3.00 | pick | tsq01op7b48ij6dfa2tst60vbfm9rcus | inserting row 3 |
1089-
+--------------+--------+----------------------------------+-----------------+
1083+
rebase_order | action | commit_hash | commit_message
1084+
--------------+--------+----------------------------------+-----------------
1085+
1.00 | pick | tgltn67jjho1mp8a3jdl3jkip08jbbun | inserting row 1
1086+
2.00 | pick | qa1t5ieqs418s1b7mssqlmpn68ackq20 | inserting row 2
1087+
3.00 | pick | m2v3oajs9jesvvc44ihqlsu1uq2c8jf2 | inserting row 3
1088+
(3 rows)
10901089

10911090
-- adjust the rebase plan to reword the first commit, drop the commit that inserted row 2,
10921091
-- and combine the third commit into the previous commit
@@ -1099,14 +1098,14 @@ select dolt_rebase('--continue');
10991098

11001099
-- check out the history
11011100
select commit_hash, message from dolt_log;
1102-
+----------------------------------+----------------------------+
1103-
| commit_hash | message |
1104-
+----------------------------------+----------------------------+
1105-
| 8jc1dpj25fv6f2kn3bd47uokc8hs1vp0 | insert rows |
1106-
| hb9fnqnrsd5ghq3fgag0kiq6nvpsasvo | inserting row 0 |
1107-
| 35gfll6o322aq9uffdqin1dqmq7q3vek | creating table t |
1108-
| do1tp9u39vsja3c8umshv9p6fernr0lt | Inіtіalizе dаta repоsitоry |
1109-
+----------------------------------+----------------------------+
1101+
commit_hash | message
1102+
----------------------------------+----------------------------
1103+
8jc1dpj25fv6f2kn3bd47uokc8hs1vp0 | insert rows
1104+
gd5rnrmjvbf0fb6sb8dfaf5a344t68ei | inserting row 0
1105+
nof0lk6ufv031mddiahqfqfelqcpjdv5 | creating table t
1106+
pfjaqljdrdn43877sbc2d2sla9g3eb8u | CREATE DATABASE
1107+
k23mej9jdej41s0n7o2g8gp5rpgvrfdb | Initialize data repository
1108+
(5 rows)
11101109
```
11111110

11121111
## `DOLT_REMOTE()`

0 commit comments

Comments
 (0)