> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/19/reference/sql-commands/sql-drop-owned.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# DROP OWNED

### DROP OWNED

DROP OWNED — 移除資料庫角色所擁有的資料庫物件

### 語法

```

DROP OWNED BY { name | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]
```

### 說明

`DROP OWNED` 會移除目前資料庫中由任一指定角色所擁有的所有物件。在目前資料庫中的物件上或共用物件（資料庫、資料表空間、組態參數）上授予給這些角色的任何權限也會被撤銷。

### 參數

*`name`* : 某個角色的名稱；該角色的物件將被移除，其權限也將被撤銷。

`CASCADE` : 自動移除相依於受影響物件的物件，以及相依於這些物件的所有物件（請參閱[第 5.15 節](https://docs.postgresql.tw/19/the-sql-language/ddl/ddl-depend.md)）。

`RESTRICT` : 若有任何其他資料庫物件相依於任一受影響物件，則拒絕移除該角色所擁有的物件。這是預設行為。

### 注意事項

`DROP OWNED` 常用於為移除一個或多個角色做準備。由於 `DROP OWNED` 只影響目前資料庫中的物件，因此通常必須在每個包含待移除角色所擁有物件的資料庫中執行此命令。

使用 `CASCADE` 選項可能使命令遞迴到其他使用者所擁有的物件。

[`REASSIGN OWNED`](https://docs.postgresql.tw/19/reference/sql-commands/sql-reassign-owned.md) 命令是另一種選擇，它會重新指派一個或多個角色所擁有之所有資料庫物件的擁有權。不過，`REASSIGN OWNED` 不會處理其他物件的權限。

這些角色所擁有的資料庫與資料表空間不會被移除。

更多討論請參閱[第 21.4 節](https://docs.postgresql.tw/19/server-administration/user-manag/role-removal.md)。

### 相容性

`DROP OWNED` 命令是 PostgreSQL 擴充功能。

### 另請參閱

[REASSIGN OWNED](https://docs.postgresql.tw/19/reference/sql-commands/sql-reassign-owned.md), [DROP ROLE](https://docs.postgresql.tw/19/reference/sql-commands/sql-droprole.md)

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/sql-drop-owned.html)（原文版本：18.6；核對日期：2026-10-03）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.postgresql.tw/19/reference/sql-commands/sql-drop-owned.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
