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

「默认Database」的含义不清 #1112

Closed
xiekeyi98 opened this issue Feb 12, 2019 · 10 comments
Closed

「默认Database」的含义不清 #1112

xiekeyi98 opened this issue Feb 12, 2019 · 10 comments

Comments

@xiekeyi98
Copy link
Contributor

xiekeyi98 commented Feb 12, 2019

Question

(v2.1,v2.0,v1.0)/sql/util.md文件中,USE语句的用法描述

切换默认 Database,当 SQL 语句中的表没有显式指定的 Database 时,即使用默认 Database。

不太理解「默认」的意思。

以下是相关操作的部分结果:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| PERFORMANCE_SCHEMA |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> USE test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> USE m125323
ERROR 1049 (42000): Unknown database 'm125323'
mysql> USE
ERROR: 
USE must be followed by a database name
mysql> select version();
+----------------------------------------------+
| version()                                    |
+----------------------------------------------+
| 5.7.10-TiDB-v2.1.0-rc.3-527-g829b0e255-dirty |
+----------------------------------------------+
1 row in set (0.00 sec)

mysql> select database();
+------------+
| database() |
+------------+
| test       |
+------------+
1 row in set (0.00 sec)
@ngaut
Copy link
Member

ngaut commented Feb 12, 2019

Good point.

@xiekeyi98
Copy link
Contributor Author

I'm not sure how to change it.
PTAL @crazycs520

@ericsyh
Copy link
Contributor

ericsyh commented Apr 20, 2019

@xiekeyi98 这句话我感觉意思是说,SQL 语句里没有用 USE 的话,默认使用的是当前选定的库。使用默认 Database 的确不准确。

这么改是不是好点:
切换需要使用的 Database,当 SQL 语句中的表没有显式指定的 Database 时,即默认使用当前选定的 Database。

英文文档也有同样的问题。
建议修改:
The USE statement is used to switch the selected database. If the table in this SQL statement does not correspond to an explicitly specified database, then the current selected database will be used by default.

@xiekeyi98
Copy link
Contributor Author

@ericsyh 我也是这么理解的,但是这个当没有指定的时候返回的是 ERROR,我认为,是不是这个就不应该算是“默认情况”?

@ericsyh
Copy link
Contributor

ericsyh commented Apr 20, 2019

@xiekeyi98 不是的哈,这个是说 SQL 表操作的时候的默认情况,像 USE这种库操作自然不在范围内了。

当 SQL 语句中的没有显式指定的 Database 时

@xiekeyi98
Copy link
Contributor Author

@winkyao ,PTAL.

@winkyao
Copy link
Contributor

winkyao commented Apr 23, 2019

Do you have interests to fix this doc? @xiekeyi98

@xiekeyi98
Copy link
Contributor Author

@winkyao
当然,我很高兴有机会能处理它。

但是,我认为 @ericsyh 已经有了比较完善的提议和修改方案了,不知道 @ericsyh 是否有兴趣先来处理一下这个 issue?
如果他比较忙的话,我很荣幸能为此贡献一个 PR。

@ericsyh
Copy link
Contributor

ericsyh commented Apr 23, 2019

@xiekeyi98 没问题,我来弄吧。
会找 i18n 的同学帮忙 review 下。

lilin90 pushed a commit that referenced this issue Apr 25, 2019
* docs-cn #1112 Update the USE command explanation in util document

* Update sql/util.md

LGTM

Co-Authored-By: ericsyh <[email protected]>

* Update v1.0/sql/util.md

LGTM

Co-Authored-By: ericsyh <[email protected]>

* Update v2.0/sql/util.md

LGTM

Co-Authored-By: ericsyh <[email protected]>

* Update v2.1/sql/util.md

LGTM

Co-Authored-By: ericsyh <[email protected]>
@lilin90
Copy link
Member

lilin90 commented Apr 25, 2019

@xiekeyi98 This issue has been resolved. @ericsyh Thanks!

@lilin90 lilin90 closed this as completed Apr 25, 2019
lilin90 added a commit that referenced this issue May 13, 2019
* sql: update tidb slow log operation

* update log

* update log

* modify the translation: requirements vs recommendations

* improve the translation

* dm: add description for task overview monitor

* dm: add description for instances' monitor

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* dm: address comments

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* v2.1/tools, v2.1/tools: update TiDB-Binlog (#1245)

v2.1/tools: update TiDB-Binlog

* fix incorrect IP address parsing and other inline code formatting

* *: move overview and features (#1253)

Via: pingcap/docs#1045

* TOC: update the quickstart link (#1255)

* sql: remove redundant content in privilege && user, tiny clean up

* Apply suggestions from code review

Co-Authored-By: dcalvin <[email protected]>

* Apply suggestions from code review

Co-Authored-By: dcalvin <[email protected]>

* Update tools/dm/monitor.md

Co-Authored-By: csuzhangxc <[email protected]>

* dm: address comments

* add digest declare

* update eg

* add stats eg

* update eg

* address comment and add more field

* TOC: covert docs-cn to DITA TOC (#1242)

* TOC: covert docs-cn to DITA TOC

* TOC: update wording

* TOC: refine wording

* toc: update description and a link

* toc: update wording

* toc: update a file name

* toc: remove the K8s link

* toc: fix a link about incremental replication

* toc: update a blog post link to Chinese version

* toc: fix a link and update wording

* toc: update key features and overview

* toc: update About TiDB

* add declare for v2.1.8

* address comment

* change the link of back-restore in tidb-binlog document

* address comment

* *: remove doc redundant space

* sql/slow_query: add pt-digest-query version

* tools: update a lightning download link

* address comment

* sql, TOC: update doc title (#1262)

* benchmark: update the Note format

* op-guide: update the Note format

* benchmark, op-guide: Update the Note format (#1273)

benchmark, op-guide: update the Note format

* *: update the Note format

* address comment

* *: update the Note format

* benchmark, v2.1/benchmark: remove an invalid link (#1275)

* benchmark: remove an invalid link

* v2.1/benchmark: remove an invalid link

* update condition (#1265)

* Update sql/slow-query.md

Co-Authored-By: crazycs520 <[email protected]>

* Update sql/slow-query.md

Co-Authored-By: crazycs520 <[email protected]>

* sql: update the USE command explanation in util document (#1269)

* docs-cn #1112 Update the USE command explanation in util document

* Update sql/util.md

LGTM

Co-Authored-By: ericsyh <[email protected]>

* Update v1.0/sql/util.md

LGTM

Co-Authored-By: ericsyh <[email protected]>

* Update v2.0/sql/util.md

LGTM

Co-Authored-By: ericsyh <[email protected]>

* Update v2.1/sql/util.md

LGTM

Co-Authored-By: ericsyh <[email protected]>

* update the loader pprof-addr default port (#1256)

* tools: clarify meaning of "N/A" (#1267)

* releases: correct the TiDB-Ansible version (#1280)

* sql: fix some format mistakes (#1277)

* Sql: fix some format mistakes

* Update sql/slow-query.md

Co-Authored-By: IzabelWang <[email protected]>

* Update sql/slow-query.md

Co-Authored-By: IzabelWang <[email protected]>

* Update sql/slow-query.md

Co-Authored-By: IzabelWang <[email protected]>

* Update op-guide/tidb-config-file.md

Co-Authored-By: IzabelWang <[email protected]>

* Update sql/slow-query.md

Co-Authored-By: IzabelWang <[email protected]>

* Remove unnecessary space

* Update slow-query.md

* Update slow-query.md

* sql: update generated columns docs

* address comment and add issue link

* *: rename how-to get started (#1281)

* *: rename how-to get started

Related PR: pingcap/docs#1046

* *: fix aliases link path

* sql: update content structure and wording (#1259)

* TOC: update a doc title (#1285)

* tools/lightning: fix a broken link (#1287)

* explain for update statement (#1284)

* tools, toc: reorganize TiDB Binlog documents (#1264)

* reorg the binlog documents

* update TOC format

* change the pd to file in overview

* update the ansible-deployment link

* rename the previous version of tidb-binlog to tidb-binlog-local

* Make the explaination of pausing and paused more clear

* change the order in TOC

* uncomment some necessary configs in kafka version

* add more explaination of paused and offline in overview

* fix the typo

* Add the Topic config in Kafka driver

* update the gc intro in deployment

* remove unnecessary step in deployment

* remove the compression in deploy document

* remove sql in the file dainer

* update the download link in deployment

* Time and size limits delete

* abandon enable-tolerant config

* move the reparo document into binlog folder

* update the rapero download link

* update drainer_pd to drainer_file

* trouble-shooting: update the issue report link (#1289)

* trouble-shooting: update the issue report link

* Update trouble-shooting.md

Co-Authored-By: CaitinChen <[email protected]>

* Update trouble-shooting.md

Co-Authored-By: CaitinChen <[email protected]>

* Update trouble-shooting.md

Co-Authored-By: CaitinChen <[email protected]>

* tools/binlog: optimize the TiDB-Binlog documents (#1291)

* fix some problems with suggestions from Lilian and Calvin

* tools/binlog: fix and update format (#1292)

* tools/binlog: fix and update format

* tools/binlog: update wording

* tools/binlog: update a link

* Update tools/binlog/upgrade.md

Co-Authored-By: lilin90 <[email protected]>

* tools: update syncer batch size (#1288)

* tools/dm: fix the error in valus from ansible command (#1293)

* sql: fix punctuation and format

* circle.yml: [WIP] comment publish pdf cmd

* TOC, releases: add 2.1.9 release notes (#1298)

* TOC, releases: add 2.1.9 release notes

PTAL

* Update 2.1.9.md

* releases: fix format

* tools: update loader status addr (#1299)

* Add charset check in Syncer precheck (#1300)

* Add charset check in Syncer precheck

* Update tools/syncer.md

Co-Authored-By: ericsyh <[email protected]>

* circle.yml: remove IP address (#1301)

* *: change "登陆" to “登录” (#1302)

* sql: fix format (#1303)

* sql: update a comma (#1305)

* sql: replace "jeffrey" with "test" (#1309)

* op-guide/monitor: update the PD API DOC link (#1311)

* Update the link

* Update the PD API DOC link

* tools: fix the format error in Syncer (#1306)

* Fix the format error in Syncer

* Update tools/syncer.md

Co-Authored-By: ericsyh <[email protected]>

* update a link (#1313)

* op-guide: add a guide about upgrading to 3.0 (#1258)

* Add rolling update TiDB 3.0 guide.

* Add rolling update TiDB 3.0 guide.

* Apply suggestions from code review

Co-Authored-By: superlzs0476 <[email protected]>

* Apply suggestions from code review

* Apply suggestions from code review

Co-Authored-By: liubo <[email protected]>

* op-guide: update a note format

* op-guide: update wording

* op-guide: update format

* circle.yml: add a new IP for qiniu (#1315)

* sql: fix typo (#1286)

* media, tools: update TiDB-Lightning architecture

Via: pingcap/docs#1128

* Delete useless instruction (#1308)

* TOC, releases: add TiDB 3.0.0 RC1 release notes (#1316)

* TOC, releases: add TiDB 3.0.0 RC1 release notes

PTAL

* Fix format

* add new updates

* Update TOC.md

* Update rn.md

* op-guide, toc: fix upgrade wording and update TOC (#1318)

* op-guide, tools: fix a link and remove duplicated file (#1319)

* *: update version limit for DM/Syncer (#1312)

* toc, support: reorganize TOC and update a link (#1320)

* toc, support: reorganize TOC and update a link

Related PR: #1279

* toc: udpate description

* toc: update wording

* *: rename how-to deploy/configure/secure/monitor
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

No branches or pull requests

5 participants