forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
37 lines
5.5 KiB
HTML
37 lines
5.5 KiB
HTML
<a name="EN-US_TOPIC_0000001098830616"></a><a name="EN-US_TOPIC_0000001098830616"></a>
|
|
|
|
<h1 class="topictitle1">DROP SCHEMA</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001098830616__sd9cce01767634d859a2812aa716cc926"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001098830616__ae5579d7851244a4c94e4f9820d6199a2"><strong id="EN-US_TOPIC_0000001098830616__b84235270694532">DROP SCHEMA</strong> deletes a schema in a database.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098830616__s0243b556f698484e9e2eb9d414274203"><h4 class="sectiontitle">Precautions</h4><p id="EN-US_TOPIC_0000001098830616__a9c8b1eb99a8d4ab58c8e8ede74ef9230">Only a schema owner or a system administrator can run the <strong id="EN-US_TOPIC_0000001098830616__b84235270695334">DROP SCHEMA</strong> command.</p>
|
|
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098830616__se5314fab51384bbf84cdede70c33e797"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001098830616__sc9988e8b24a441ee9a5cecee8e581464"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">SCHEMA</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">IF</span><span class="w"> </span><span class="k">EXISTS</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="k">schema_name</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...]</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">CASCADE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">RESTRICT</span><span class="w"> </span><span class="p">];</span><span class="w"></span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098830616__s594063b1d7594b30b3f414d2f4987c80"><h4 class="sectiontitle">Parameter Description</h4><ul id="EN-US_TOPIC_0000001098830616__u885b796d936542dea950ade97878c347"><li id="EN-US_TOPIC_0000001098830616__l2a75bc5c87d246209b9d053c81fdf28d"><strong id="EN-US_TOPIC_0000001098830616__a99d9abecf7294e78aa399c88f72f8310">IF EXISTS</strong><p id="EN-US_TOPIC_0000001098830616__afa821e84f7eb4c8e9c3d1631103b1ff4">Sends a notice instead of an error if the specified schema does not exist.</p>
|
|
</li><li id="EN-US_TOPIC_0000001098830616__l729ec35f243a413096a572d0b57b1940"><strong id="EN-US_TOPIC_0000001098830616__a679f0bea00b94f54b248c6414fa84423">schema_name</strong><p id="EN-US_TOPIC_0000001098830616__a33509743c89243a3843fc6ffbff37e22">Specifies the name of a schema.</p>
|
|
<p id="EN-US_TOPIC_0000001098830616__a86d467a7343f40c19c54ef1ad1397655">Value range: An existing schema name.</p>
|
|
</li><li id="EN-US_TOPIC_0000001098830616__lbf0cc66764bf496da5e8b825c85ddac0"><strong id="EN-US_TOPIC_0000001098830616__a4d156c5017614b96a48ec0e2bce7e8b0">CASCADE | RESTRICT</strong><ul id="EN-US_TOPIC_0000001098830616__u42dcc1249c74494bb0b258b1e5f32bef"><li id="EN-US_TOPIC_0000001098830616__lb98a64f0ae08492aa1ffeb59a177a1ef"><strong id="EN-US_TOPIC_0000001098830616__en-us_topic_0058965787_b842352706195636">CASCADE</strong>: automatically deletes all objects that are contained in the schema to be deleted.</li><li id="EN-US_TOPIC_0000001098830616__led3e17d8ca6d4c2c86152540a5291341"><strong id="EN-US_TOPIC_0000001098830616__en-us_topic_0058965787_b842352706195646">RESTRICT</strong>: refuses to delete the schema that contains any objects. This is the default.</li></ul>
|
|
</li></ul>
|
|
<div class="notice" id="EN-US_TOPIC_0000001098830616__ndf5bd8fe41d54c4ca55a736e9c1910b1"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="EN-US_TOPIC_0000001098830616__ad1bc5e57edd2465190c93328dc258b2e">Do not delete the schemas with the beginning of <strong id="EN-US_TOPIC_0000001098830616__b842352706195358">pg_temp</strong> or <strong id="EN-US_TOPIC_0000001098830616__b84235270619543">pg_toast_temp</strong>. They are internal system schemas, and deleting them may cause unexpected errors.</p>
|
|
</div></div>
|
|
<div class="note" id="EN-US_TOPIC_0000001098830616__nfaa0692934294a20bfa2a939fedc0811"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001098830616__ae91a5bb5407f489e8396bf1a7fc6330f">A user cannot delete the schema in use. To delete the schema in use, switch to another schema.</p>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098830616__s45876b9c4f8343b08a05c469d97a0cd0"><h4 class="sectiontitle">Example</h4><p id="EN-US_TOPIC_0000001098830616__p1571613413369">Delete the <strong id="EN-US_TOPIC_0000001098830616__b137341354163714">ds_new</strong> schema.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001098830616__screen334517452493">DROP SCHEMA ds_new;</pre>
|
|
<p id="EN-US_TOPIC_0000001098830616__p1583082515499"></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001098830616__s737fbcda683644dd8eea29954b8ef3ea"><h4 class="sectiontitle">Links</h4><p id="EN-US_TOPIC_0000001098830616__ad8b7aaa2f4ca424b898da45067a7fbb6"><a href="dws_06_0136.html">ALTER SCHEMA</a>, <a href="dws_06_0173.html">CREATE SCHEMA</a></p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0118.html">DDL Syntax</a></div>
|
|
</div>
|
|
</div>
|
|
|