Skip to content
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

cli: support \d client-side command with no arguments #40309

Merged

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Aug 28, 2019

\d can be used with no arguments as a way to show all the
tables in a database. This is an alias for \dt.

Release note (cli change): Support \d client-side command with no
arguments as an alias for \dt, for more ease of adoption by psql
users.

@rafiss rafiss requested a review from a team as a code owner August 28, 2019 21:13
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@jordanlewis jordanlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@kenliu kenliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, nice addition!

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

@knz
Copy link
Contributor

knz commented Aug 29, 2019

No comment on the code but I'll paste this comment I made to Ken a while ago: the word "metacommand" is an anachronism and would be best replaced by "client-side command".

Small bit of history: the word "metacommand" was introduced by pg in the 1980s-1990s at a time where there was a lot of activity in PL design. Back then there was a craze around "meta" constructs: bits of syntax in a language that would be expanded into other bits of syntax in the same language before the program would be further compiled/interpreted. Back then they were calling it "meta syntax" or "meta languages".

  1. We call this "preprocessing" and "macros" today, not "meta"

  2. CockroachDB does not do preprocessing on these things server-side. They are in fact compiled by the client into other things sent to the server.

Hence the name "client-side command". Also the word "client-side" puts the emphasis on the fact this is specific to the CockroachDB SQL shell, and therefore users should not expect \d etc to work if using another SQL client. With a true "meta-command" the meta-command would be understood server-side and the client would not matter.

@rafiss
Copy link
Collaborator Author

rafiss commented Aug 29, 2019

Thanks for the feedback everyone. @knz: that makes sense, thanks for the background! I was copying the verbiage used in the initial PR that added support for this, but I will adjust the wording in the code and commit message before merging.

`\d` can be used with no arguments as a way to show all the
tables in a database. This is an alias for `\dt`.

Release note (cli change): Support `\d` client-side command with no
arguments as an alias for `\dt`, for more ease of adoption by `psql`
users.
@rafiss rafiss force-pushed the support-show-tables-metacommand-alias branch from f4e10a1 to f5bc459 Compare August 29, 2019 14:42
@rafiss rafiss changed the title cli: support \d metacommand with no arguments cli: support \d client-side command with no arguments Aug 29, 2019
@rafiss
Copy link
Collaborator Author

rafiss commented Aug 29, 2019

bors r+

craig bot pushed a commit that referenced this pull request Aug 29, 2019
40309: cli: support \d client-side command with no arguments r=rafiss a=rafiss

`\d` can be used with no arguments as a way to show all the
tables in a database. This is an alias for `\dt`.

Release note (cli change): Support `\d` client-side command with no
arguments as an alias for `\dt`, for more ease of adoption by `psql`
users.

Co-authored-by: Rafi Shamim <rafi@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Aug 29, 2019

Build succeeded

@craig craig bot merged commit f5bc459 into cockroachdb:master Aug 29, 2019
@rafiss rafiss deleted the support-show-tables-metacommand-alias branch September 3, 2019 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants