In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what is the role of the force option provided by PG 13". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the role of the force option provided by PG 13"?
In PG 12 or below, you cannot delete a database if there is a connection. PG 13 provides the force option to terminate the connection and delete the database directly.
PG 12
Create a database and connect
[pg12@localhost ~] $createdb dropdb [pg12@localhost ~] $[pg12@localhost ~] $psql-d dropdbExpanded display is used automatically.psql (12.1) Type "help" for help. [local:/run/pg12]: 5120 pg12@dropdb=#
Delete the database, waiting all the time, prompt after timeout
[pg12@localhost] $psqlExpanded display is used automatically.psql (12.1) Type "help" for help. [local:/run/pg12]: 5120 pg12@testdb=# drop database dropdb;ERROR: database "dropdb" is being accessed by other usersDETAIL: There is 1 other session using the database.
PG 13
Create a database and connect
[pg13@localhost ~] $createdb dropdb [pg13@localhost ~] $psql-d dropdbExpanded display is used automatically.psql (13devel) Type "help" for help. [local:/run/pg13]: 5130 pg13@dropdb=#
Delete the database, indicating that the database cannot be deleted
[pg13@localhost ~] $psqlExpanded display is used automatically.psql (13devel) Type "help" for help. [local:/run/pg13]: 5130 pg13@masterdb=# drop database dropdb;ERROR: database "dropdb" is being accessed by other usersDETAIL: There is 1 other session using the database. [local:/run/pg13]: 5130 pg13@masterdb=#
Delete using the force option
[local:/run/pg13]: 5130 pg13@masterdb=# drop database dropdb with (force); DROP DATABASE [local:/run/pg13]: 5130 pg13@masterdb=#
Back to the session that connects to the dropdb database, the session has been drop
[local:/run/pg13]: 5130 pg13@dropdb=# select 1: terminating connection due to administrator commandserver closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.The connection to the server was lost. Attempting reset: Failed.: @! >? Thank you for your reading, the above is the content of "what is the role of force options provided by PG 13". After the study of this article, I believe you have a deeper understanding of the role of force options provided by PG 13, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.