-
Notifications
You must be signed in to change notification settings - Fork 474
Add COMMENT ON / Update SHOW TABLES #4617
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained
v19.1/comment-on.md, line 45 at r1 (raw file):
~~~ To view all comments:
Is there a way to view a specific database's comments?
v19.1/comment-on.md, line 93 at r1 (raw file):
~~~ To view column comments:
How do you view column comments? I tried SELECT col_description(dogs.name);
but it didn't work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below: I am not comfortable showing SQL examples for database and column comments until we have proper support in SHOW. (This is an oversight in my part - please create issues).
In the meantime, I think it would be good to more prominently explain that this new feature is best used using database GUI navigation tools. These will be able to set and view comments "naturally" because we use the same API as PostgreSQL. Maybe it would be useful to include a screenshot taken with dbeaver.
Reviewed 5 of 5 files at r1.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @lhirata and @rmloveland)
v19.1/comment-on.md, line 42 at r1 (raw file):
~~~ sql > SELECT * FROM system.comments;
I recommend against using any system
table anywhere in documentation.
v19.1/comment-on.md, line 45 at r1 (raw file):
Previously, lhirata wrote…
Is there a way to view a specific database's comments?
It's an oversight on my part that we do not have a way to view comments with SHOW DATABASES.
Please file an issue in the cockroach repo and cc me on it.
There's a way that is usable by UI tools, but which we are not yet ready to document (see my comment at top).
The query (for your personal enlightnment, although I don't recommend documenting it here) is this:
select pg_catalog.obj_description((select oid from pg_database where datname='customers'));
In the meantime, I would recommend to not document a SQL example here. Instead, highlight that the comment can be viewed with a GUI tool.
v19.1/comment-on.md, line 93 at r1 (raw file):
Previously, lhirata wrote…
How do you view column comments? I tried
SELECT col_description(dogs.name);
but it didn't work
Same as above.
It's an oversight on my part that we do not have a way to view comments with SHOW COLUMNS.
Please file an issue in the cockroach repo and cc me on it.
There's a way that is usable by UI tools, but which we are not yet ready to document (see my comment at top).
The query (for your personal enlightnment, although I don't recommend documenting it here) is this:
select pg_catalog.col_description(t.oid, a.attnum) from pg_class t, pg_attribute a where t.oid = a.attrelid and t.relname = 'dogs' and a.attname='name';
In the meantime, I would recommend to not document a SQL example here. Instead, highlight that the comment can be viewed with a GUI tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks for the info. Opened an issue to add SHOW ... WITH COMMENTS
here.
Added a callout to suggest using this feature with a GUI. Will hold off on screenshots for now.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @knz and @rmloveland)
v19.1/comment-on.md, line 42 at r1 (raw file):
Previously, knz (kena) wrote…
I recommend against using any
system
table anywhere in documentation.
Done.
v19.1/comment-on.md
Outdated
COMMENT ON TABLE | ||
~~~ | ||
|
||
[To view table comments](show-tables.html): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest changing this to something like
To view table comments, use
SHOW TABLES
.
v19.1/show-tables.md
Outdated
@@ -113,10 +116,28 @@ This uses the [current schema](sql-name-resolution.html#current-schema) `public` | |||
(3 rows) | |||
~~~ | |||
|
|||
### Show tables with comments | |||
|
|||
<span class="version-tag">New in v19.1:</span> To view a table's comments: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest editing slightly to something like:
New in v19.1: You can add and view comments on a table. To view a table's comments:
## See also | ||
|
||
- [`SHOW DATABASES`](show-databases.html) | ||
- [`SHOW SCHEMAS`](show-schemas.html) | ||
- [`CREATE TABLE`](create-table.html) | ||
- [`CREATE VIEW`](create-view.html) | ||
- [`COMMENT ON`](comment-on.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOICE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a couple of small but non-critical wording suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @knz and @rmloveland)
v19.1/comment-on.md, line 60 at r2 (raw file):
Previously, rmloveland (Rich Loveland) wrote…
Suggest changing this to something like
To view table comments, use
SHOW TABLES
.
Done.
v19.1/show-tables.md, line 121 at r2 (raw file):
Previously, rmloveland (Rich Loveland) wrote…
Suggest editing slightly to something like:
New in v19.1: You can add and view comments on a table. To view a table's comments:
Done.
v19.1/show-tables.md, line 142 at r2 (raw file):
Previously, rmloveland (Rich Loveland) wrote…
NOICE
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, but I have a few nits and questions.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @jseldess, @knz, @lhirata, and @rmloveland)
v19.1/comment-on.md, line 45 at r3 (raw file):
~~~ To view column comments, use a database GUI navigation tool (e.g., [dBeaver](dBeaver.html)).
column comments
> database comments
v19.1/comment-on.md, line 62 at r3 (raw file):
To view table comments, use [`SHOW TABLES`](show-tables.html): ~~~ sql
Add copy to clipboard.
v19.1/comment-on.md, line 75 at r3 (raw file):
### Add a comment to a column To add a comment to a column:
This command looks identical to the comment for adding a comment to a table. How is this column-specific?
v19.1/show-tables.md, line 121 at r3 (raw file):
### Show tables with comments <span class="version-tag">New in v19.1:</span>You can add and view comments on a table. To view a table's comments:
Should we link to COMMENT ON
somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @jseldess, @knz, and @rmloveland)
v19.1/comment-on.md, line 45 at r3 (raw file):
Previously, jseldess (Jesse Seldess) wrote…
column comments
>database comments
Done.
v19.1/comment-on.md, line 62 at r3 (raw file):
Previously, jseldess (Jesse Seldess) wrote…
Add copy to clipboard.
Done.
v19.1/comment-on.md, line 75 at r3 (raw file):
Previously, jseldess (Jesse Seldess) wrote…
This command looks identical to the comment for adding a comment to a table. How is this column-specific?
This was copy/paste messiness. Updated to be COMMENT ON COLUMN dogs.name
v19.1/show-tables.md, line 121 at r3 (raw file):
Previously, jseldess (Jesse Seldess) wrote…
Should we link to
COMMENT ON
somehow?
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 3 files at r3, 2 of 2 files at r5.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @jseldess, @lhirata, and @rmloveland)
v19.1/comment-on.md, line 10 at r5 (raw file):
{{site.data.alerts.callout_success}} `COMMENT ON` is best suited for use with database GUI navigation tools (e.g., [dBeaver](dbeaver.html)).
is currently best suited ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @lhirata and @rmloveland)
Edits based on feedback Edits based on feedback Edit based on feedback + add to SQL Statements page Fix broken links Edits based on feedback Edit based on feedback
COMMENT ON
statementSHOW TABLES ... WITH COMMENT
Closes #4261, #4182, #4262.