> 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/appendixes/contrib/cube/cube-syntax.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# F.10.1. 語法

## F.10.1. 語法 [#](#cube-syntax) <a href="#cube-syntax" id="cube-syntax"></a>

[表 F.1](#cube-repr-table) 顯示 `cube` 型別有效的外部表示法。*`x`*、 *`y`* 等表示浮點數。

### 表 F.1. Cube 外部表示法 [#](#cube-repr-table) <a href="#cube-repr-table" id="cube-repr-table"></a>

| 外部語法                                                | 意義                                     |
| --------------------------------------------------- | -------------------------------------- |
| *`x`*                                               | 一維點 （或長度為零的一維區間）                       |
| `(`*`x`*`)`                                         | 同上                                     |
| *`x1`*`,`*`x2`*`,...,`*`xn`*                        | n 維空間中的點，在內部表示為 體積為零的 cube             |
| `(`*`x1`*`,`*`x2`*`,...,`*`xn`*`)`                  | 同上                                     |
| `(`*`x`*`),(`*`y`*`)`                               | 從 *`x`* 開始到 *`y`* 結束的一維區間，或反向亦可； 順序不重要 |
| `[(`*`x`*`),(`*`y`*`)]`                             | 同上                                     |
| `(`*`x1`*`,...,`*`xn`*`),(`*`y1`*`,...,`*`yn`*`)`   | 由一對對角表示的 n 維 cube                      |
| `[(`*`x1`*`,...,`*`xn`*`),(`*`y1`*`,...,`*`yn`*`)]` | 同上                                     |

<br>

輸入 cube 對角的順序不重要。`cube` 函式會在需要時自動交換值，以建立統一的 「左下 — 右上」內部表示法。角點重合時，`cube` 僅儲存一個角點及「is point」 旗標，避免浪費空間。

輸入時會忽略空白，因此 `[(x),(y)]` 與 `[ ( x ), ( y ) ]` 相同。

[返回 F.10. cube — 多維 cube 資料型別](https://docs.postgresql.tw/19/appendixes/contrib/cube.md#cube)

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/cube.html)


---

# 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/appendixes/contrib/cube/cube-syntax.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.
