Skip to content

Accept MySQL alternate query terminators and output presentation format #489

Open
@bart-schaefer

Description

@bart-schaefer

Columns in some of our tables contain formatted text. It's difficult to work with this when displayed in a horizontal grid row. It is also sometimes useful to view SHOW CREATE TABLE output (rather than DESCRIBE), which is also unwieldy in a grid display.

MySQL client supports alternate query terminator \G to specify vertical display of labeled columns. Example:

db> select * from truth_category_response limit 1\G
*************************** 1. row ***************************
contact_id: 447584192
category_name: any
recency: 2022-11-20 14:53:50
computable: yes
report_time: 2022-11-21 10:30:23
1 row in set (0.03 sec)

db> show create table truth_category_response\G
*************************** 1. row ***************************
Table: truth_category_response
Create Table: CREATE TABLE truth_category_response (
contact_id int(10) unsigned NOT NULL DEFAULT '0',
category_name varchar(255) NOT NULL DEFAULT 'any',
recency datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
computable enum('yes','no') DEFAULT 'yes',
report_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (contact_id,category_name),
KEY recency (recency,computable)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.02 sec)

Currently I run the query with ; (or with no terminator if it's the only query in the editor) and then copy-paste from a column into the query editor or the scratchpad in order to see the full value including line breaks.

MySQL client also supports \g (lowercase) as equivalent to ;, it would be nice if that did not produce a syntax error.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

📌 To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions