Editing Delete database

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
* https://www.postgresql.org/docs/current/sql-dropdatabase.html
 
  
== [[PostgreSQL]] ==
+
= =[[PostgreSQL]] ==
[[DROP DATABASE]] [IF EXISTS] [[my_database_name]][[;]]
+
* <code>DROP DATABASE [IF EXISTS] database_name;</code>
Do not forget the <code>;</code> at the end of the line
+
DROP DATABASE
  
  
 +
== See also ==
 +
* {{TOC operation databases}}
  
[[DROP DATABASE]] [IF EXISTS] [[my_database_name]] (FORCE) [[;]]
 
Note: FORCE introduced in 2022 ([[PostgreSQL 13]])
 
 
DROP DATABASE database_name;
 
Output:
 
DROP DATABASE
 
 
DROP DATABASE database_name (FORCE);
 
 
 
ERROR: database "XXXXX" is being accessed by other users
 
DETAIL: There are 4 other sessions using the database
 
 
Related terms:
 
* <code>[[sudo -u postgres psql]]</code>
 
* <code>[[community.postgresql.postgresql_db_module]]: state: [[absent]]</code>
 
 
== Related ==
 
* <code>[[DELETE]]</code>
 
* <code>[[DROP TABLE]]</code>
 
* <code>[[CREATE DATABASE]]</code>
 
* <code>[[\list]]</code>
 
* [[PostgreSQL superuser]]
 
* <code> [[ALTER DATABASE]]</code>
 
* <code> [[ERROR: must be owner of database]]</code>
 
 
* <code> [[GRANT "your-defined role" TO "your username";]]</code
 
>
 
 
== See also ==
 
* {{DROP}}
 
* {{Database ops}}
 
* {{Role}}
 
  
 
[[Category:Databases]]
 
[[Category:Databases]]

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Templates used on this page:

Advertising: