cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.04k stars 3.8k forks source link

Add `DESCRIBE` SQL command to show the structure of database objects #58949

Open ianjevans opened 3 years ago

ianjevans commented 3 years ago

Is your feature request related to a problem? Please describe. I routinely try using the DESCRIBE command in CRDB, after using Cassandra/CQL for years. Using DESCRIBE TABLE <table> is a little more intuitive than SHOW CREATE TABLE <table> since it's both shorter and more accurately describes what I'm doing (i.e. I'm looking at the structure of the db objects, not looking at how it was created).

The pattern of the DESCRIBE command is more consistent than the SHOW commands. Some of them are SHOW CREATE while others are just SHOW. Each DESCRIBE command has a plural version that returns the structure of the objects within the current database.

Describe the solution you'd like Support for the following commands:

DESCRIBE DATABASE <database_name>;
DESCRIBE DATABASES;
DESCRIBE INDEX <index_name>;
DESCRIBE INDEXES;
DESCRIBE SCHEMA <schema_name>;
DESCRIBE SCHEMAS;
DESCRIBE SEQUENCE <sequence_name>;
DESCRIBE SEQUENCES;
DESCRIBE TABLE <table_name>;
DESCRIBE TABLES;
DESCRIBE TYPE <type_name>;
DESCRIBE TYPES;
DESCRIBE VIEW <view_name>;
DESCRIBE VIEWS;

These should be aliases for the equivalent SHOW command. For example, the following commands are equivalent:

DESCRIBE TABLE <table_name>;
SHOW CREATE TABLE <table_name>;

Describe alternatives you've considered All of these have equivalent SHOW commands.

Additional context Oracle, MySQL, and Cassandra have the DESCRIBE command. https://cassandra.apache.org/doc/latest/cql/ddl.html#describe

Jira issue: CRDB-3355

blathers-crl[bot] commented 3 years ago

Hi @ianjevans, I've guessed the C-ategory of your issue and suitably labeled it. Please re-label if inaccurate.

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

awoods187 commented 3 years ago

@otan might be worth investigating this too